refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
1
database/migrations/.gitkeep
Normal file
1
database/migrations/.gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
37
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
37
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->enum('gender', ['male', 'female']);
|
||||
$table->string('email')->unique();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('users');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token')->index();
|
||||
$table->timestamp('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('password_resets');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOauthAuthCodesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('oauth_auth_codes', function (Blueprint $table) {
|
||||
$table->string('id', 100)->primary();
|
||||
$table->unsignedBigInteger('user_id')->index();
|
||||
$table->unsignedBigInteger('client_id');
|
||||
$table->text('scopes')->nullable();
|
||||
$table->boolean('revoked');
|
||||
$table->dateTime('expires_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('oauth_auth_codes');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOauthAccessTokensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('oauth_access_tokens', function (Blueprint $table) {
|
||||
$table->string('id', 100)->primary();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index();
|
||||
$table->unsignedBigInteger('client_id');
|
||||
$table->string('name')->nullable();
|
||||
$table->text('scopes')->nullable();
|
||||
$table->boolean('revoked');
|
||||
$table->timestamps();
|
||||
$table->dateTime('expires_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('oauth_access_tokens');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOauthRefreshTokensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('oauth_refresh_tokens', function (Blueprint $table) {
|
||||
$table->string('id', 100)->primary();
|
||||
$table->string('access_token_id', 100)->index();
|
||||
$table->boolean('revoked');
|
||||
$table->dateTime('expires_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('oauth_refresh_tokens');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOauthClientsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('oauth_clients', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index();
|
||||
$table->string('name');
|
||||
$table->string('secret', 100)->nullable();
|
||||
$table->string('provider')->nullable();
|
||||
$table->text('redirect');
|
||||
$table->boolean('personal_access_client');
|
||||
$table->boolean('password_client');
|
||||
$table->boolean('revoked');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('oauth_clients');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOauthPersonalAccessClientsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('oauth_personal_access_clients', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('client_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('oauth_personal_access_clients');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateAccountTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('accounts', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('api_key');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('accounts');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddAccountInfoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->integer('account_id')->after('remember_token');
|
||||
$table->string('send_sms_alert')->default('false')->after('account_id');
|
||||
$table->integer('phone_number')->nullable()->after('send_sms_alert');
|
||||
$table->integer('amazon_store_country_id')->nullable()->after('phone_number');
|
||||
$table->string('timezone')->nullable()->after('amazon_store_country_id');
|
||||
$table->string('locale')->default('en')->after('timezone');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function ($table) {
|
||||
$table->dropColumn(['account_id', 'send_sms_alert', 'phone_number', 'amazon_store_country_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
135
database/migrations/2016_06_08_005413_create_contacts_table.php
Normal file
135
database/migrations/2016_06_08_005413_create_contacts_table.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateContactsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('contacts', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('entity_id')->nullable();
|
||||
$table->enum('status', ['adult', 'parent', 'kid']);
|
||||
$table->string('first_name');
|
||||
$table->string('middle_name')->nullable();
|
||||
$table->string('last_name')->nullable();
|
||||
$table->string('surname')->nullable();
|
||||
$table->enum('gender', ['male', 'female']);
|
||||
$table->enum('nature_of_relationship', ['friend', 'family', 'friend_of_friend', 'business'])->nullable();
|
||||
$table->enum('couple_status', ['married', 'engaged', 'complicated', 'dates', 'single'])->nullable();
|
||||
$table->string('is_birthdate_approximate')->default('false')->nullable();
|
||||
$table->dateTime('birthdate')->nullable();
|
||||
$table->string('warned_about_birthdate')->default('true');
|
||||
$table->string('email')->unique()->nullable();
|
||||
$table->string('phone_number')->nullable();
|
||||
$table->string('twitter_id')->nullable();
|
||||
$table->string('instagram_id')->nullable();
|
||||
$table->string('is_first_met_date_approximate')->default('false')->nullable();
|
||||
$table->dateTime('first_met')->nullable();
|
||||
$table->string('first_met_where')->nullable();
|
||||
$table->longText('first_met_additional_info')->nullable();
|
||||
$table->string('job')->nullable();
|
||||
$table->dateTime('last_talked_to')->nullable();
|
||||
$table->string('street')->nullable();
|
||||
$table->string('city')->nullable();
|
||||
$table->string('province')->nullable();
|
||||
$table->string('postal_code')->nullable();
|
||||
$table->integer('country_id')->nullable();
|
||||
$table->longText('food_preferencies')->nullable();
|
||||
$table->string('has_kids')->default('false')->nullable();
|
||||
$table->integer('first_parent_id')->nullable;
|
||||
$table->integer('second_parent_id')->nullable;
|
||||
$table->dateTime('viewed_at')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('kids', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('contact_id_first_parent');
|
||||
$table->integer('contact_id_second_parent')->nullable();
|
||||
$table->string('was_part_of_entity_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('entities', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->string('name');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('important_dates', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->enum('type', ['entity', 'contact']);
|
||||
$table->integer('contact_id');
|
||||
$table->dateTime('date_to_remember');
|
||||
$table->string('description');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('gifts', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->string('people_id');
|
||||
$table->enum('type_of_people', ['parent', 'kid']);
|
||||
$table->enum('nature', ['amazon', 'other']);
|
||||
$table->integer('amazon_gift_id')->nullable();
|
||||
$table->string('occasion');
|
||||
$table->string('giving_date')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('countries', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('iso');
|
||||
$table->string('country');
|
||||
});
|
||||
|
||||
Schema::create('peoples', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('api_id');
|
||||
$table->integer('account_id');
|
||||
$table->enum('type', ['entity', 'contact']);
|
||||
$table->integer('object_id');
|
||||
$table->dateTime('viewed_at')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('reminders', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('people_id');
|
||||
$table->string('title')->nullable();
|
||||
$table->longText('description')->nullable();
|
||||
$table->string('frequency_type');
|
||||
$table->integer('frequency_number')->nullable();
|
||||
$table->dateTime('last_triggered')->nullable();
|
||||
$table->dateTime('next_expected_date');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('contacts', 'kids', 'important_dates', 'entities', 'gifts', 'note_object', 'notes', 'countries', 'peoples', 'reminders');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateReminderTypeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('reminder_types', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('description');
|
||||
$table->string('translation_key');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::table('reminders', function (Blueprint $table) {
|
||||
$table->integer('reminder_type_id')->after('people_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('reminder_types');
|
||||
|
||||
Schema::table('reminders', function ($table) {
|
||||
$table->dropColumn(['reminder_type_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
38
database/migrations/2016_06_28_191025_create_tasks_table.php
Normal file
38
database/migrations/2016_06_28_191025_create_tasks_table.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTasksTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tasks', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('people_id');
|
||||
$table->string('title');
|
||||
$table->longText('description')->nullable();
|
||||
$table->enum('status', ['completed', 'inprogress', 'archived']);
|
||||
$table->dateTime('completed_at')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('tasks');
|
||||
}
|
||||
}
|
||||
42
database/migrations/2016_06_30_185050_create_notes_table.php
Normal file
42
database/migrations/2016_06_30_185050_create_notes_table.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateNotesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notes', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('people_id');
|
||||
$table->enum('type', ['activity', 'phone_call', 'note', 'gift_idea']);
|
||||
$table->string('title')->nullable();
|
||||
$table->mediumText('body');
|
||||
$table->integer('activity_type_id')->nullable();
|
||||
$table->dateTime('activity_date')->nullable();
|
||||
$table->string('sticky')->default('false');
|
||||
$table->string('remind_for_next_call_or_email')->default('false');
|
||||
$table->integer('author_id');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('notes');
|
||||
}
|
||||
}
|
||||
32
database/migrations/2016_07_25_133835_add_width_field.php
Normal file
32
database/migrations/2016_07_25_133835_add_width_field.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddWidthField extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('fluid_container')->default('false')->after('locale');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function ($table) {
|
||||
$table->dropColumn('fluid_container');
|
||||
});
|
||||
}
|
||||
}
|
||||
54
database/migrations/2016_08_28_122938_create_kids_table.php
Normal file
54
database/migrations/2016_08_28_122938_create_kids_table.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateKidsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// drop existing kids table (created in a former migration)
|
||||
Schema::drop('kids');
|
||||
|
||||
Schema::create('kids', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('child_of_people_id');
|
||||
$table->enum('gender', ['male', 'female']);
|
||||
$table->string('first_name');
|
||||
$table->string('is_birthdate_approximate')->default('false')->nullable();
|
||||
$table->dateTime('birthdate')->nullable();
|
||||
$table->longText('food_preferencies')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::table('peoples', function ($table) {
|
||||
$table->string('has_kids')->default('false')->after('object_id')->nullable();
|
||||
$table->integer('number_of_kids')->after('has_kids')->nullable();
|
||||
});
|
||||
|
||||
Schema::table('contacts', function ($table) {
|
||||
$table->dropColumn(['first_parent_id', 'status', 'has_kids', 'warned_about_birthdate']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('kids');
|
||||
|
||||
Schema::table('peoples', function ($table) {
|
||||
$table->dropColumn('has_kids');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateRelationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function ($table) {
|
||||
$table->dropColumn(['second_parent_id', 'couple_status']);
|
||||
});
|
||||
|
||||
Schema::create('significant_others', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('people_id');
|
||||
$table->enum('status', ['active', 'past']);
|
||||
$table->string('first_name');
|
||||
$table->string('last_name')->nullable();
|
||||
$table->enum('gender', ['male', 'female']);
|
||||
$table->string('is_birthdate_approximate')->default('false')->nullable();
|
||||
$table->dateTime('birthdate')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('significant_others');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddReminderIdToContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->integer('birthday_reminder_id')->nullable()->after('birthdate');
|
||||
});
|
||||
|
||||
Schema::table('kids', function (Blueprint $table) {
|
||||
$table->integer('birthday_reminder_id')->nullable()->after('birthdate');
|
||||
});
|
||||
|
||||
Schema::table('significant_others', function (Blueprint $table) {
|
||||
$table->integer('birthday_reminder_id')->nullable()->after('birthdate');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function ($table) {
|
||||
$table->dropColumn('fluid_container');
|
||||
});
|
||||
|
||||
Schema::table('kids', function ($table) {
|
||||
$table->dropColumn('fluid_container');
|
||||
});
|
||||
|
||||
Schema::table('significant_others', function ($table) {
|
||||
$table->dropColumn('fluid_container');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddLastTalkedToField extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function ($table) {
|
||||
$table->dropColumn('last_talked_to');
|
||||
});
|
||||
|
||||
Schema::table('peoples', function (Blueprint $table) {
|
||||
$table->dateTime('last_talked_to')->nullable()->after('number_of_kids');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddPeopleIdToContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->integer('people_id')->nullable()->after('entity_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddNameInfoToPeoples extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('peoples', function (Blueprint $table) {
|
||||
$table->string('sortable_name')->nullable()->after('object_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateActivityTypeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('activity_types', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('activity_type_group_id');
|
||||
$table->string('key');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('activity_type_groups', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->string('key');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
37
database/migrations/2016_09_10_164406_create_jobs_table.php
Normal file
37
database/migrations/2016_09_10_164406_create_jobs_table.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue');
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
$table->index(['queue', 'reserved_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateNotificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('people_id');
|
||||
$table->enum('for', ['reminder']);
|
||||
$table->enum('how', ['email']);
|
||||
$table->string('address');
|
||||
$table->longText('content');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddKidToReminder extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('reminders', function (Blueprint $table) {
|
||||
$table->integer('kid_id')->nullable()->after('reminder_type_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddDeletedAtToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
32
database/migrations/2016_10_19_155139_create_cache_table.php
Normal file
32
database/migrations/2016_10_19_155139_create_cache_table.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCacheTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->unique();
|
||||
$table->text('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSessionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->unique();
|
||||
$table->integer('user_id')->nullable();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->text('payload');
|
||||
$table->integer('last_activity');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddStatisticsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('statistics', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('number_of_users');
|
||||
$table->integer('number_of_contacts');
|
||||
$table->integer('number_of_notes');
|
||||
$table->integer('number_of_reminders');
|
||||
$table->integer('number_of_tasks');
|
||||
$table->integer('number_of_kids');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddJournalSettingToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('onboarding_journal_dismissed')->default('false')->after('fluid_container');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateJournalTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('gifts');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddMetricToSettings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('metric')->default('fahrenheit')->after('locale');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateActivitiesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('activities', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('people_id');
|
||||
$table->integer('activity_type_id');
|
||||
$table->longText('description')->nullable();
|
||||
$table->dateTime('date_it_happened');
|
||||
$table->integer('user_id_of_the_writer');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
29
database/migrations/2016_11_01_015957_add_icon_column.php
Normal file
29
database/migrations/2016_11_01_015957_add_icon_column.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddIconColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('activity_types', function ($table) {
|
||||
$table->string('icon')->after('key');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddActivityLocationToActivities extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('activity_types', function (Blueprint $table) {
|
||||
$table->string('location_type')->after('key');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
36
database/migrations/2016_11_09_013049_add_events_table.php
Normal file
36
database/migrations/2016_11_09_013049_add_events_table.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddEventsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('events', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('people_id');
|
||||
$table->string('object_type');
|
||||
$table->integer('object_id');
|
||||
$table->string('nature_of_operation');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveTypeFromNotes extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('notes', function ($table) {
|
||||
$table->dropColumn('type');
|
||||
$table->dropColumn('activity_type_id');
|
||||
$table->dropColumn('sticky');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
42
database/migrations/2016_12_13_133945_add_gifts_table.php
Normal file
42
database/migrations/2016_12_13_133945_add_gifts_table.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddGiftsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('gifts', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('people_id');
|
||||
$table->string('about_object_type')->nullable();
|
||||
$table->string('about_object_id')->nullable();
|
||||
$table->string('title');
|
||||
$table->longText('description')->nullable();
|
||||
$table->longText('url')->nullable();
|
||||
$table->string('value_in_dollars')->nullable();
|
||||
$table->string('is_an_idea')->default('true');
|
||||
$table->string('has_been_offered')->default('false');
|
||||
$table->dateTime('date_offered')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeTitleColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('reminders', function ($table) {
|
||||
$table->string('title', 60000)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFacebookColumnsToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('facebook_user_id')->index();
|
||||
$table->string('access_token')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'facebook_user_id',
|
||||
'access_token'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddColorsToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->string('default_avatar_color');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'default_avatar_color'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFieldsToContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->string('has_kids')->default('false')->after('gender');
|
||||
$table->integer('number_of_kids')->default('0')->after('has_kids');
|
||||
$table->date('last_talked_to')->nullable()->after('number_of_kids');
|
||||
$table->integer('number_of_reminders')->default('0')->after('last_talked_to');
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'entity_id', 'people_id', 'twitter_id', 'instagram_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->integer('contact_id')->after('account_id');
|
||||
});
|
||||
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'people_id', 'user_id_of_the_writer'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'has_kids', 'number_of_kids', 'last_talked_to', 'number_of_reminders'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'contact_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->integer('entity_id')->nullable();
|
||||
$table->integer('people_id')->nullable();
|
||||
$table->string('twitter_id')->nullable();
|
||||
$table->string('instagram_id')->nullable();
|
||||
});
|
||||
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->integer('people_id')->after('account_id');
|
||||
$table->integer('user_id_of_the_writer');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangePeopleToContactForKids extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('kids', function (Blueprint $table) {
|
||||
$table->integer('child_of_contact_id')->after('account_id');
|
||||
});
|
||||
|
||||
Schema::table('kids', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'child_of_people_id'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('kids', function (Blueprint $table) {
|
||||
$table->integer('child_of_people_id')->after('account_id');
|
||||
});
|
||||
|
||||
Schema::table('kids', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'child_of_contact_id'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangePeopleToSignificantother extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('significant_others', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'people_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('significant_others', function (Blueprint $table) {
|
||||
$table->integer('contact_id')->after('account_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('significant_others', function (Blueprint $table) {
|
||||
$table->integer('people_id')->after('account_id');
|
||||
});
|
||||
|
||||
Schema::table('significant_others', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'contact_id'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeNotesToContact extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('notes', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'people_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('notes', function (Blueprint $table) {
|
||||
$table->integer('contact_id')->after('account_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddNotesCountToContact extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->integer('number_of_notes')->default(0)->after('number_of_reminders');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'number_of_reminders'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangePeopleInEvents extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'people_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->integer('contact_id')->after('account_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'contact_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->integer('people_id')->after('account_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveDeletedAtFromSignificantOthers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('significant_others', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'deleted_at'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveDeletedAtFromKids extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('kids', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'deleted_at'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('kids', function (Blueprint $table) {
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveDeletedAtFromNotes extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('notes', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'deleted_at', 'title', 'activity_date', 'remind_for_next_call_or_email', 'author_id'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('notes', function (Blueprint $table) {
|
||||
$table->string('title')->nullable();
|
||||
$table->dateTime('activity_date')->nullable();
|
||||
$table->string('remind_for_next_call_or_email')->default('false');
|
||||
$table->integer('author_id');
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveViewedAtFromContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumn('contacts', 'viewed_at')) {
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn('viewed_at');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
if (! Schema::hasColumn('contacts', 'viewed_at')) {
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dateTime('viewed_at')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveDeleteAtFromActivities extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'deleted_at'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->dateTime('deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddNumberActivitiesToContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->integer('number_of_activities')->after('number_of_notes')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'number_of_activities'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddActivityStatisticsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('activity_statistics', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('contact_id');
|
||||
$table->integer('year');
|
||||
$table->integer('count');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('activity_statistics');
|
||||
}
|
||||
}
|
||||
37
database/migrations/2017_02_02_232450_add_confirmation.php
Normal file
37
database/migrations/2017_02_02_232450_add_confirmation.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddConfirmation extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->boolean('confirmed')->default(false);
|
||||
$table->string('confirmation_code')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('confirmed');
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('confirmation_code');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeRemindersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('reminders', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'deleted_at', 'people_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('reminders', function (Blueprint $table) {
|
||||
$table->integer('contact_id')->after('account_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('reminders', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'contact_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('reminders', function (Blueprint $table) {
|
||||
$table->integer('people_id')->after('account_id');
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddGiftsMetricsToContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->integer('number_of_gifts_ideas')->default(0)->after('number_of_activities');
|
||||
$table->integer('number_of_gifts_received')->default(0)->after('number_of_gifts_ideas');
|
||||
$table->integer('number_of_gifts_offered')->default(0)->after('number_of_gifts_received');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'number_of_gifts_ideas', 'number_of_gifts_received', 'number_of_gifts_offered'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
34
database/migrations/2017_02_05_041740_change_gifts_table.php
Normal file
34
database/migrations/2017_02_05_041740_change_gifts_table.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeGiftsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('gifts', function (Blueprint $table) {
|
||||
$table->renameColumn('title', 'name');
|
||||
$table->renameColumn('description', 'comment');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('gifts', function (Blueprint $table) {
|
||||
$table->renameColumn('name', 'title');
|
||||
$table->renameColumn('comment', 'description');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangePeopleToContactForGifts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('gifts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'people_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('gifts', function (Blueprint $table) {
|
||||
$table->integer('contact_id')->after('account_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('gifts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'contact_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('gifts', function (Blueprint $table) {
|
||||
$table->integer('people_id')->after('account_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
45
database/migrations/2017_02_07_041607_change_tasks_table.php
Normal file
45
database/migrations/2017_02_07_041607_change_tasks_table.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeTasksTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'people_id', 'deleted_at'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->integer('contact_id')->after('account_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'contact_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->integer('people_id')->after('account_id');
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddNumberTasksToContact extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->integer('number_of_tasks')->after('number_of_gifts_offered')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'number_of_tasks'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeNumberTasksContact extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'number_of_tasks'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->integer('number_of_tasks_in_progress')->after('number_of_gifts_offered');
|
||||
$table->integer('number_of_tasks_completed')->after('number_of_tasks_in_progress');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'number_of_tasks_completed', 'number_of_gifts_offered'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->integer('number_of_tasks');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddSortPreferencesToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('contacts_sort_order')->after('onboarding_journal_dismissed')->default('firstnameAZ');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'contacts_sort_order'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveNotificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::drop('notifications');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('people_id');
|
||||
$table->enum('for', ['reminder']);
|
||||
$table->enum('how', ['email']);
|
||||
$table->string('address');
|
||||
$table->longText('content');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemovePeopleTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::drop('peoples');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('peoples', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('api_id');
|
||||
$table->integer('account_id');
|
||||
$table->enum('type', ['entity', 'contact']);
|
||||
$table->integer('object_id');
|
||||
$table->string('sortable_name')->nullable()->after('object_id');
|
||||
$table->string('has_kids')->default('false')->after('object_id')->nullable();
|
||||
$table->integer('number_of_kids')->after('has_kids')->nullable();
|
||||
$table->dateTime('last_talked_to')->nullable();
|
||||
$table->dateTime('viewed_at')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveEntitiesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::drop('entities');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('entities', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->string('name');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Contact\Gift;
|
||||
use App\Models\Contact\Note;
|
||||
use App\Models\Contact\Task;
|
||||
use App\Models\Contact\Contact;
|
||||
use App\Models\Account\Activity;
|
||||
use App\Models\Contact\Reminder;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CalculateStatistics extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
* @psalm-suppress UndefinedMagicPropertyAssignment
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Contact::unsetEventDispatcher();
|
||||
foreach (Contact::all() as $contact) {
|
||||
$contact->number_of_reminders = Reminder::where('contact_id', $contact->id)->count();
|
||||
$contact->number_of_notes = Note::where('contact_id', $contact->id)->count();
|
||||
$contact->number_of_activities = Activity::where('contact_id', $contact->id)->count();
|
||||
$contact->number_of_gifts_ideas = Gift::where('contact_id', $contact->id)->where('is_an_idea', 'true')->count();
|
||||
$contact->number_of_gifts_offered = Gift::where('contact_id', $contact->id)->where('has_been_offered', 'true')->count();
|
||||
$contact->number_of_tasks_in_progress = Task::where('contact_id', $contact->id)->where('status', 'inprogress')->count();
|
||||
$contact->number_of_tasks_completed = Task::where('contact_id', $contact->id)->where('status', 'completed')->count();
|
||||
$contact->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddAvatarsToContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->string('has_avatar')->after('food_preferencies')->default('false');
|
||||
$table->string('avatar_file_name')->after('has_avatar')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'has_avatar', 'avatar_file_name'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateEntriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('entries', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->string('title')->nullable();
|
||||
$table->longText('post');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('entries');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MoveSignificantOtherData extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('significant_others', function (Blueprint $table) {
|
||||
$table->dropColumn('last_name');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveContactEncryption extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
* @psalm-suppress UndefinedMagicPropertyAssignment
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$contacts = Contact::all();
|
||||
foreach ($contacts as $contact) {
|
||||
echo $contact->id;
|
||||
if (! is_null($contact->email)) {
|
||||
$contact->email = decrypt($contact->email);
|
||||
}
|
||||
|
||||
if (! is_null($contact->phone_number)) {
|
||||
$contact->phone_number = decrypt($contact->phone_number);
|
||||
}
|
||||
|
||||
if (! is_null($contact->street)) {
|
||||
$contact->street = decrypt($contact->street);
|
||||
}
|
||||
|
||||
if (! is_null($contact->city)) {
|
||||
$contact->city = decrypt($contact->city);
|
||||
}
|
||||
|
||||
if (! is_null($contact->province)) {
|
||||
$contact->province = decrypt($contact->province);
|
||||
}
|
||||
|
||||
if (! is_null($contact->postal_code)) {
|
||||
$contact->postal_code = decrypt($contact->postal_code);
|
||||
}
|
||||
|
||||
if ($contact->is_birthdate_approximate == 'true') {
|
||||
$contact->is_birthdate_approximate = 'approximate';
|
||||
}
|
||||
|
||||
if ($contact->is_birthdate_approximate == 'false') {
|
||||
$contact->is_birthdate_approximate = 'exact';
|
||||
}
|
||||
$contact->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTitleToActivities extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->string('summary')->after('activity_type_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AlterActivityNullable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('activities', function (Blueprint $table) {
|
||||
$table->unsignedInteger('activity_type_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Contact\Task;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveEncryptionTasks extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$tasks = Task::all();
|
||||
foreach ($tasks as $task) {
|
||||
echo $task->id.' ';
|
||||
if (! is_null($task->title)) {
|
||||
$task->title = decrypt($task->title);
|
||||
}
|
||||
|
||||
if (! is_null($task->description)) {
|
||||
$task->description = decrypt($task->description);
|
||||
}
|
||||
|
||||
$task->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Contact\Reminder;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemovePredefinedReminders extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$reminders = Reminder::all();
|
||||
foreach ($reminders as $reminder) {
|
||||
echo $reminder->id.' ';
|
||||
if (! is_null($reminder->title)) {
|
||||
$reminder->title = decrypt($reminder->title);
|
||||
}
|
||||
|
||||
if (! is_null($reminder->description)) {
|
||||
$reminder->description = decrypt($reminder->description);
|
||||
}
|
||||
|
||||
$reminder->save();
|
||||
}
|
||||
|
||||
Schema::table('reminders', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
'reminder_type_id'
|
||||
);
|
||||
});
|
||||
|
||||
Schema::drop('reminder_types');
|
||||
}
|
||||
}
|
||||
26
database/migrations/2017_05_30_023116_create_money_table.php
Normal file
26
database/migrations/2017_05_30_023116_create_money_table.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateMoneyTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('debts', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('contact_id');
|
||||
$table->string('in_debt')->default('no');
|
||||
$table->string('status')->default('inprogress');
|
||||
$table->integer('amount');
|
||||
$table->longText('reason')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use App\Helpers\DBHelper;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddMultipleGendersChoices extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$driverName = DBHelper::connection()->getDriverName();
|
||||
switch ($driverName) {
|
||||
case 'mysql':
|
||||
DB::statement('ALTER TABLE '.DBHelper::getTable('contacts')." CHANGE COLUMN gender gender ENUM('male', 'female', 'none')");
|
||||
DB::statement('ALTER TABLE '.DBHelper::getTable('significant_others')." CHANGE COLUMN gender gender ENUM('male', 'female', 'none')");
|
||||
DB::statement('ALTER TABLE '.DBHelper::getTable('kids')." CHANGE COLUMN gender gender ENUM('male', 'female', 'none')");
|
||||
break;
|
||||
case 'pgsql':
|
||||
$this->alterEnum(DBHelper::getTable('contacts'), 'gender', ['male', 'female', 'none']);
|
||||
$this->alterEnum(DBHelper::getTable('significant_others'), 'gender', ['male', 'female', 'none']);
|
||||
$this->alterEnum(DBHelper::getTable('kids'), 'gender', ['male', 'female', 'none']);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("Driver {$driverName} not supported.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter an enum field constraints. Source: https://stackoverflow.com/a/36198549.
|
||||
*
|
||||
* @param $table
|
||||
* @param $field
|
||||
* @param array $options
|
||||
*/
|
||||
protected function alterEnum($table, $field, array $options)
|
||||
{
|
||||
$check = "${table}_${field}_check";
|
||||
$enumList = [];
|
||||
foreach ($options as $option) {
|
||||
$enumList[] = sprintf("'%s'::CHARACTER VARYING", $option);
|
||||
}
|
||||
$enumString = implode(', ', $enumList);
|
||||
DB::transaction(function () use ($table, $field, $check, $enumString) {
|
||||
DB::statement(sprintf('ALTER TABLE %s DROP CONSTRAINT %s;', $table, $check));
|
||||
DB::statement(sprintf('ALTER TABLE %s ADD CONSTRAINT %s CHECK (%s::TEXT = ANY (ARRAY[%s]::TEXT[]))', $table, $check, $field, $enumString));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddSocialNetworksToContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->string('facebook_profile_url')->after('avatar_file_name')->nullable();
|
||||
$table->string('twitter_profile_url')->after('facebook_profile_url')->nullable();
|
||||
$table->string('linkedin_profile_url')->after('twitter_profile_url')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCurrenciesData extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('currencies', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('iso');
|
||||
$table->string('name');
|
||||
$table->string('symbol');
|
||||
});
|
||||
|
||||
//defaults
|
||||
DB::table('currencies')->insert(['iso' => 'CAD', 'name' => 'Canadian Dollar', 'symbol'=>'$']);
|
||||
DB::table('currencies')->insert(['iso' => 'USD', 'name' => 'US Dollar', 'symbol'=>'$']);
|
||||
DB::table('currencies')->insert(['iso' => 'GBP', 'name' => 'British Pound', 'symbol'=>'£']);
|
||||
DB::table('currencies')->insert(['iso' => 'EUR', 'name' => 'Euro', 'symbol'=>'€']);
|
||||
DB::table('currencies')->insert(['iso' => 'RUB', 'name' => 'Russian Ruble', 'symbol'=>'₽']);
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$dollarResult = DB::table('currencies')->select('id')->where('iso', '=', 'USD')->value('id');
|
||||
$table->integer('currency_id')->after('timezone')->default(
|
||||
$dollarResult
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Journal\Entry;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveEncryptionJournal extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$entries = Entry::all();
|
||||
foreach ($entries as $entry) {
|
||||
echo $entry->id.' ';
|
||||
if (! is_null($entry->title)) {
|
||||
$entry->title = decrypt($entry->title);
|
||||
}
|
||||
|
||||
if (! is_null($entry->post)) {
|
||||
$entry->post = decrypt($entry->post);
|
||||
}
|
||||
|
||||
$entry->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeUniqueConstraintForContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropUnique(['email']);
|
||||
|
||||
$table->unique(['account_id', 'email'], 'unique_for_each_account_email_pair');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropUnique('unique_for_each_account_email_pair');
|
||||
|
||||
$table->unique('email');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Contact\Gift;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveGiftsEncryption extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$gifts = Gift::all();
|
||||
foreach ($gifts as $gift) {
|
||||
|
||||
// Uncomment the line below if you need to debug which row poses problem
|
||||
//echo $gift->id;
|
||||
if (! is_null($gift->name)) {
|
||||
$gift->name = decrypt($gift->name);
|
||||
}
|
||||
|
||||
if (! is_null($gift->comment)) {
|
||||
$gift->comment = decrypt($gift->comment);
|
||||
}
|
||||
|
||||
if (! is_null($gift->url)) {
|
||||
$gift->url = decrypt($gift->url);
|
||||
}
|
||||
|
||||
$gift->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddCompanyToContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->string('company')->after('job')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveBernTimezone extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$users = User::all();
|
||||
foreach ($users as $user) {
|
||||
if ($user->timezone == 'Europe/Bern') {
|
||||
$user->timezone = 'Europe/Berlin';
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddZarCurrencyToCurrenciesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::table('currencies')->insert(['iso' => 'ZAR', 'name' => 'South African Rand', 'symbol'=>'R ']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Contact\Reminder;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddAboutWhoToReminders extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('reminders', function (Blueprint $table) {
|
||||
$table->string('is_birthday')->after('contact_id')->default('false');
|
||||
$table->string('about_object')->after('is_birthday')->nullable();
|
||||
$table->string('about_object_id')->after('about_object')->nullable();
|
||||
});
|
||||
|
||||
// Migrate all kids birthdays to the new system to track birthdays reminders
|
||||
foreach (Reminder::all() as $reminder) {
|
||||
if ($reminder->kid_id) {
|
||||
$reminder->is_birthday = 'true';
|
||||
$reminder->about_object = 'kid';
|
||||
$reminder->about_object_id = $reminder->kid_id;
|
||||
$reminder->save();
|
||||
}
|
||||
}
|
||||
|
||||
// Get rid of the kid_id field
|
||||
Schema::table('reminders', function (Blueprint $table) {
|
||||
$table->dropColumn(
|
||||
['kid_id']
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
22
database/migrations/2017_06_17_010900_fix_contacts_table.php
Normal file
22
database/migrations/2017_06_17_010900_fix_contacts_table.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixContactsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
foreach (Contact::all() as $contact) {
|
||||
if ($contact->is_birthdate_approximate == 'exact' and is_null($contact->birthday_reminder_id)) {
|
||||
$contact->is_birthdate_approximate = 'approximate';
|
||||
$contact->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RefactorUserTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'facebook_user_id',
|
||||
'access_token',
|
||||
'amazon_store_country_id',
|
||||
'onboarding_journal_dismissed',
|
||||
'send_sms_alert',
|
||||
'phone_number',
|
||||
'gender',
|
||||
'deleted_at',
|
||||
]);
|
||||
|
||||
$table->integer('invited_by_user_id')->after('contacts_sort_order')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('invitations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('invited_by_user_id');
|
||||
$table->string('email');
|
||||
$table->string('invitation_key');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddStripeFieldsToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('accounts', function ($table) {
|
||||
$table->string('stripe_id')->after('api_key')->nullable();
|
||||
$table->string('card_brand')->after('stripe_id')->nullable();
|
||||
$table->string('card_last_four')->after('card_brand')->nullable();
|
||||
$table->timestamp('trial_ends_at')->after('card_last_four')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('subscriptions', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->string('name');
|
||||
$table->string('stripe_id');
|
||||
$table->string('stripe_plan');
|
||||
$table->integer('quantity');
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamp('ends_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddInvitationsStatistics extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('accounts', function ($table) {
|
||||
$table->integer('number_of_invitations_sent')->after('api_key')->nullable();
|
||||
});
|
||||
|
||||
Schema::table('statistics', function ($table) {
|
||||
$table->integer('number_of_invitations_sent')->after('number_of_kids')->nullable();
|
||||
$table->integer('number_of_accounts_with_more_than_one_user')->after('number_of_invitations_sent')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddNameOrderToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('name_order')->default('firstname_first')->after('contacts_sort_order');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateImportTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('import_jobs', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('user_id');
|
||||
$table->string('type')->default('vcard');
|
||||
$table->integer('contacts_found')->nullable();
|
||||
$table->integer('contacts_skipped')->nullable();
|
||||
$table->integer('contacts_imported')->nullable();
|
||||
$table->string('filename')->nullable();
|
||||
$table->date('started_at')->nullable();
|
||||
$table->date('ended_at')->nullable();
|
||||
$table->boolean('failed')->default(0);
|
||||
$table->mediumText('failed_reason')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('import_job_reports', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('user_id');
|
||||
$table->integer('import_job_id');
|
||||
$table->mediumText('contact_information');
|
||||
$table->boolean('skipped');
|
||||
$table->string('skip_reason')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddImportJobToStatistics extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('statistics', function ($table) {
|
||||
$table->integer('number_of_import_jobs')->after('number_of_accounts_with_more_than_one_user')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddGravatarUrlToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->string('gravatar_url')->nullable()->after('avatar_file_name');
|
||||
});
|
||||
}
|
||||
}
|
||||
32
database/migrations/2017_07_02_155736_create_tags_table.php
Normal file
32
database/migrations/2017_07_02_155736_create_tags_table.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTagsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tags', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->string('name');
|
||||
$table->string('name_slug');
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('contact_tag', function (Blueprint $table) {
|
||||
$table->integer('contact_id');
|
||||
$table->integer('tag_id');
|
||||
$table->integer('account_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTagsToStatistics extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('statistics', function ($table) {
|
||||
$table->integer('number_of_tags')->after('number_of_accounts_with_more_than_one_user')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class UpdateBadTranslationKey extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::table('activity_types')
|
||||
->where('id', 1)
|
||||
->update(['key' => 'just_hung_out']);
|
||||
}
|
||||
}
|
||||
25
database/migrations/2017_07_12_014244_create_calls_table.php
Normal file
25
database/migrations/2017_07_12_014244_create_calls_table.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCallsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('calls', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('account_id');
|
||||
$table->integer('contact_id');
|
||||
$table->dateTime('called_at');
|
||||
$table->mediumText('content')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DropRemindersCountFromContacts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropColumn('number_of_reminders');
|
||||
});
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user