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/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite
|
||||
37
database/factories/Account/AddressBookFactory.php
Normal file
37
database/factories/Account/AddressBookFactory.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\Account;
|
||||
|
||||
use App\Models\User\User;
|
||||
use App\Models\Account\Account;
|
||||
use App\Models\Account\AddressBook;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AddressBookFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var class-string<\Illuminate\Database\Eloquent\Model>
|
||||
*/
|
||||
protected $model = AddressBook::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'account_id' => factory(Account::class)->create(),
|
||||
'user_id' => function (array $attributes) {
|
||||
return factory(User::class)->create([
|
||||
'account_id' => $attributes['account_id'],
|
||||
]);
|
||||
},
|
||||
'name' => 'contacts1',
|
||||
'description' => $this->faker->sentence,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\Account;
|
||||
|
||||
use App\Models\User\User;
|
||||
use App\Models\Account\Account;
|
||||
use App\Models\Account\AddressBook;
|
||||
use App\Models\Account\AddressBookSubscription;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AddressBookSubscriptionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var class-string<\Illuminate\Database\Eloquent\Model>
|
||||
*/
|
||||
protected $model = AddressBookSubscription::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'account_id' => factory(Account::class)->create(),
|
||||
'user_id' => function (array $attributes) {
|
||||
return factory(User::class)->create([
|
||||
'account_id' => $attributes['account_id'],
|
||||
]);
|
||||
},
|
||||
'address_book_id' => function (array $attributes) {
|
||||
return AddressBook::factory()->create([
|
||||
'account_id' => $attributes['account_id'],
|
||||
'user_id' => $attributes['user_id'],
|
||||
]);
|
||||
},
|
||||
'name' => $this->faker->word,
|
||||
'uri' => $this->faker->url,
|
||||
'capabilities' => [
|
||||
'addressbookMultiget' => true,
|
||||
'addressbookQuery' => true,
|
||||
'syncCollection' => true,
|
||||
'addressData' => [
|
||||
'content-type' => 'text/vcard',
|
||||
'version' => '4.0',
|
||||
],
|
||||
],
|
||||
'username' => $this->faker->email,
|
||||
'password' => 'password',
|
||||
'syncToken' => '"test"',
|
||||
];
|
||||
}
|
||||
}
|
||||
36
database/factories/Account/ExportJobFactory.php
Normal file
36
database/factories/Account/ExportJobFactory.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories\Account;
|
||||
|
||||
use App\Models\User\User;
|
||||
use App\Models\Account\Account;
|
||||
use App\Models\Account\ExportJob;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ExportJobFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var class-string<\Illuminate\Database\Eloquent\Model>
|
||||
*/
|
||||
protected $model = ExportJob::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'account_id' => factory(Account::class)->create(),
|
||||
'user_id' => function (array $attributes) {
|
||||
return factory(User::class)->create([
|
||||
'account_id' => $attributes['account_id'],
|
||||
]);
|
||||
},
|
||||
'type' => 'json',
|
||||
];
|
||||
}
|
||||
}
|
||||
156
database/factories/AccountFactory.php
Normal file
156
database/factories/AccountFactory.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use function Safe\json_decode;
|
||||
|
||||
$factory->define(App\Models\Account\Account::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'api_key' => Str::random(30),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Activity::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'activity_type_id' => function (array $data) {
|
||||
return factory(App\Models\Account\ActivityType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'description' => $faker->sentence,
|
||||
'summary' => $faker->sentence,
|
||||
'happened_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\ActivityType::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'activity_type_category_id' => function (array $data) {
|
||||
return factory(App\Models\Account\ActivityTypeCategory::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'translation_key' => $faker->sentence,
|
||||
'location_type' => $faker->word,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\ActivityTypeCategory::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'translation_key' => $faker->sentence,
|
||||
'name' => $faker->sentence,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Company::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => 'Central Perk',
|
||||
'website' => 'https://centralperk.com',
|
||||
'number_of_employees' => 4,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\ImportJob::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'user_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\ImportJobReport::class, function (Faker\Generator $faker) {
|
||||
return [];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Invitation::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'invited_by_user_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'invitation_key' => Str::random(100),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Photo::class, function (Faker\Generator $faker) {
|
||||
$account = factory(App\Models\Account\Account::class)->create();
|
||||
|
||||
return [
|
||||
'account_id' => $account->id,
|
||||
'original_filename' => 'file.jpg',
|
||||
'new_filename' => 'file.jpg',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Place::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'country' => 'US',
|
||||
'street' => '12',
|
||||
'city' => 'beverly hills',
|
||||
'province' => null,
|
||||
'postal_code' => '90210',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Account\Weather::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'place_id' => function (array $data) {
|
||||
return factory(App\Models\Account\Place::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'weather_json' => json_decode('
|
||||
{
|
||||
"location": {
|
||||
"name": "Le Pre-Saint-Gervais",
|
||||
"region": "Ile-de-France",
|
||||
"country": "France",
|
||||
"lat": 48.89,
|
||||
"lon": 2.39,
|
||||
"tz_id": "Europe\/Paris",
|
||||
"localtime_epoch": 1635605324,
|
||||
"localtime": "2021-10-30 16:48"
|
||||
},
|
||||
"current": {
|
||||
"last_updated_epoch": 1635605100,
|
||||
"last_updated": "2021-10-30 16:45",
|
||||
"temp_c": 13,
|
||||
"temp_f": 55.4,
|
||||
"is_day": 0,
|
||||
"condition": {
|
||||
"text": "Partly cloudy",
|
||||
"icon": "\/\/cdn.weatherapi.com\/weather\/64x64\/night\/116.png",
|
||||
"code": 1003
|
||||
},
|
||||
"wind_mph": 5.6,
|
||||
"wind_kph": 9,
|
||||
"wind_degree": 210,
|
||||
"wind_dir": "SSW",
|
||||
"pressure_mb": 1001,
|
||||
"pressure_in": 29.56,
|
||||
"precip_mm": 0,
|
||||
"precip_in": 0,
|
||||
"humidity": 94,
|
||||
"cloud": 75,
|
||||
"feelslike_c": 11.2,
|
||||
"feelslike_f": 52.1,
|
||||
"vis_km": 10,
|
||||
"vis_miles": 6,
|
||||
"uv": 4,
|
||||
"gust_mph": 17.9,
|
||||
"gust_kph": 28.8
|
||||
}
|
||||
}'),
|
||||
'created_at' => now(),
|
||||
];
|
||||
});
|
||||
322
database/factories/ContactFactory.php
Normal file
322
database/factories/ContactFactory.php
Normal file
@@ -0,0 +1,322 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\Contact\Contact::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'first_name' => 'John',
|
||||
'last_name' => 'Doe',
|
||||
'has_avatar' => false,
|
||||
'gender_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Gender::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'uuid' => Str::uuid(),
|
||||
'default_avatar_color' => '#ffffff',
|
||||
'avatar_default_url' => 'avatars/img.png',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Contact\Contact::class, 'partial', [
|
||||
'is_partial' => 1,
|
||||
]);
|
||||
|
||||
$factory->state(App\Models\Contact\Contact::class, 'archived', [
|
||||
'is_active' => 0,
|
||||
]);
|
||||
|
||||
$factory->state(App\Models\Contact\Contact::class, 'named', function (Faker\Generator $faker) {
|
||||
return [
|
||||
'first_name' => $faker->firstName,
|
||||
'last_name' => $faker->lastName,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->state(App\Models\Contact\Contact::class, 'no_gender', function (Faker\Generator $faker) {
|
||||
return [
|
||||
'gender_id' => null,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ContactFieldType::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => 'Email',
|
||||
'protocol' => 'mailto:',
|
||||
'type' => 'email',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ContactField::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'contact_field_type_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\ContactFieldType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'data' => 'john@doe.com',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ContactFieldLabel::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'label_i18n' => 'work',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Conversation::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'contact_field_type_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\ContactFieldType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Reminder::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ReminderOutbox::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'user_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'reminder_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Reminder::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'planned_date' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Gift::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'status' => 'idea',
|
||||
'created_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Call::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'created_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Task::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'title' => $faker->word,
|
||||
'description' => $faker->word,
|
||||
'completed' => 0,
|
||||
'created_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
'uuid' => Str::uuid(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Note::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'body' => encrypt($faker->text(200)),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Address::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'place_id' => function (array $data) {
|
||||
return factory(App\Models\Account\Place::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Gender::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'type' => 'M',
|
||||
'name' => 'Man',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Debt::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Tag::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => $faker->word,
|
||||
'name_slug' => Str::slug($faker->word),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Pet::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'pet_category_id' => factory(App\Models\Contact\PetCategory::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\PetCategory::class, function (Faker\Generator $faker) {
|
||||
return [];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\ReminderRule::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Message::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'conversation_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Conversation::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Document::class, function (Faker\Generator $faker) {
|
||||
$contact = factory(App\Models\Contact\Contact::class)->create();
|
||||
|
||||
return [
|
||||
'account_id' => $contact->account_id,
|
||||
'contact_id' => $contact->id,
|
||||
'original_filename' => 'file.jpg',
|
||||
'new_filename' => 'file.jpg',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\Occupation::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'company_id' => function (array $data) {
|
||||
return factory(App\Models\Account\Company::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'title' => 'Waiter',
|
||||
'salary' => '10000',
|
||||
'salary_unit' => 'year',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\LifeEventCategory::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => $faker->text(100),
|
||||
'core_monica_data' => true,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\LifeEventType::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'life_event_category_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\LifeEventCategory::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'name' => $faker->text(100),
|
||||
'core_monica_data' => true,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Contact\LifeEvent::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'life_event_type_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\LifeEventType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'name' => $faker->text(100),
|
||||
'note' => $faker->text(100),
|
||||
'happened_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
69
database/factories/InstanceFactory.php
Normal file
69
database/factories/InstanceFactory.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
$factory->define(\App\Models\Instance\Cron::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'command' => $faker->word,
|
||||
'last_run' => now(),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\SpecialDate::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'contact_id' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'date' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
'created_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\Instance::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'uuid' => $faker->uuid,
|
||||
'latest_version' => '1.0.0',
|
||||
'current_version' => '1.0.0',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\Emotion\Emotion::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'emotion_primary_id' => factory(App\Models\Instance\Emotion\PrimaryEmotion::class)->create()->id,
|
||||
'emotion_secondary_id' => function (array $data) {
|
||||
return factory(App\Models\Instance\Emotion\SecondaryEmotion::class)->create([
|
||||
'emotion_primary_id' => $data['emotion_primary_id'],
|
||||
])->id;
|
||||
},
|
||||
'name' => $faker->text(5),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\Emotion\SecondaryEmotion::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'emotion_primary_id' => factory(App\Models\Instance\Emotion\PrimaryEmotion::class)->create()->id,
|
||||
'name' => $faker->text(5),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\Emotion\PrimaryEmotion::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->text(5),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Instance\AuditLog::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'author_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'action' => 'account_created',
|
||||
'author_name' => 'Dwight Schrute',
|
||||
'audited_at' => $faker->dateTimeThisCentury(),
|
||||
'objects' => '{"user": 1}',
|
||||
];
|
||||
});
|
||||
19
database/factories/JournalFactory.php
Normal file
19
database/factories/JournalFactory.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$factory->define(App\Models\Journal\Entry::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Journal\Day::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Journal\JournalEntry::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
39
database/factories/RelationshipFactory.php
Normal file
39
database/factories/RelationshipFactory.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
$factory->define(App\Models\Relationship\Relationship::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'relationship_type_id' => function (array $data) {
|
||||
return factory(App\Models\Relationship\RelationshipType::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'contact_is' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'of_contact' => function (array $data) {
|
||||
return factory(App\Models\Contact\Contact::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Relationship\RelationshipType::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'relationship_type_group_id' => function (array $data) {
|
||||
return factory(App\Models\Relationship\RelationshipTypeGroup::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Relationship\RelationshipTypeGroup::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
29
database/factories/SettingsFactory.php
Normal file
29
database/factories/SettingsFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
$factory->define(App\Models\Settings\Term::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'term_version' => $faker->realText(50),
|
||||
'term_content' => $faker->realText(50),
|
||||
'privacy_version' => $faker->realText(50),
|
||||
'privacy_content' => $faker->realText(50),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\Settings\Currency::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'iso' => $faker->realText(10),
|
||||
'name' => $faker->realText(10),
|
||||
'symbol' => $faker->realText(10),
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(\Laravel\Cashier\Subscription::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'name' => $faker->word(),
|
||||
'stripe_id' => $faker->word(),
|
||||
'stripe_price' => $faker->randomElement(['plan-1', 'plan-2', 'plan-3']),
|
||||
'quantity' => 1,
|
||||
'created_at' => now(),
|
||||
];
|
||||
});
|
||||
45
database/factories/UserFactory.php
Normal file
45
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$factory->define(App\Models\User\User::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'first_name' => $faker->firstName,
|
||||
'last_name' => $faker->lastName,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email_verified_at' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
'password' => bcrypt(Str::random(10)),
|
||||
'remember_token' => Str::random(10),
|
||||
'timezone' => config('app.timezone'),
|
||||
'name_order' => 'firstname_lastname',
|
||||
'locale' => 'en',
|
||||
'currency_id' => function (array $data) {
|
||||
return factory(App\Models\Settings\Currency::class)->create([
|
||||
'iso' => 'USD',
|
||||
])->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\User\Changelog::class, function (Faker\Generator $faker) {
|
||||
return [];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\User\Module::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(App\Models\User\SyncToken::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'account_id' => factory(App\Models\Account\Account::class)->create()->id,
|
||||
'user_id' => function (array $data) {
|
||||
return factory(App\Models\User\User::class)->create([
|
||||
'account_id' => $data['account_id'],
|
||||
])->id;
|
||||
},
|
||||
'timestamp' => \App\Helpers\DateHelper::parseDateTime($faker->dateTimeThisCentury()),
|
||||
];
|
||||
});
|
||||
27
database/factories/WebauthnFactory.php
Normal file
27
database/factories/WebauthnFactory.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of your model factories. Model factories give
|
||||
| you a convenient way to create models for testing and seeding your
|
||||
| database. Just tell the factory how a default model should look.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(\LaravelWebauthn\Models\WebauthnKey::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => '0',
|
||||
'name' => $faker->word,
|
||||
'counter' => 0,
|
||||
'credentialId' => 'MA==',
|
||||
'type' => 'public-key',
|
||||
'transports' => [],
|
||||
'attestationType' => 'none',
|
||||
'trustPath' => new \Webauthn\TrustPath\EmptyTrustPath,
|
||||
'aaguid' => '0000000000000000',
|
||||
'credentialPublicKey' => 'oWNrZXlldmFsdWU=',
|
||||
];
|
||||
});
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user