Commit 08886a16 authored by Viral Solani's avatar Viral Solani

regenerate migration

parent 4ae7a706
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "3ac44cf6055afa0caf4b5fed56f6ce1c", "content-hash": "f0db0856ef828bbe877e49a03cca1cd4",
"packages": [ "packages": [
{ {
"name": "arcanedev/log-viewer", "name": "arcanedev/log-viewer",
...@@ -5482,6 +5482,112 @@ ...@@ -5482,6 +5482,112 @@
"validate" "validate"
], ],
"time": "2016-11-23T20:04:58+00:00" "time": "2016-11-23T20:04:58+00:00"
},
{
"name": "xethron/laravel-4-generators",
"version": "3.1.1",
"source": {
"type": "git",
"url": "https://github.com/Xethron/Laravel-4-Generators.git",
"reference": "526f0a07d8ae44e365a20b1bf64c9956acd2a859"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Xethron/Laravel-4-Generators/zipball/526f0a07d8ae44e365a20b1bf64c9956acd2a859",
"reference": "526f0a07d8ae44e365a20b1bf64c9956acd2a859",
"shasum": ""
},
"require": {
"illuminate/support": "~5.0",
"php": ">=5.4.0"
},
"require-dev": {
"behat/behat": "~2.5.1",
"behat/mink": "~1.5.0",
"behat/mink-extension": "~1.2.0",
"behat/mink-goutte-driver": "~1.0.9",
"behat/mink-selenium2-driver": "~1.1.1",
"phpspec/phpspec": "~2.0",
"phpunit/phpunit": "~3.7"
},
"type": "library",
"autoload": {
"psr-0": {
"Way\\Generators": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jeffrey Way",
"email": "jeffrey@jeffrey-way.com"
}
],
"description": "Rapidly generate resources, migrations, models, and much more.",
"time": "2017-02-23T11:20:49+00:00"
},
{
"name": "xethron/migrations-generator",
"version": "v2.0.2",
"source": {
"type": "git",
"url": "https://github.com/Xethron/migrations-generator.git",
"reference": "a05bd7319ed808fcc3125212e37d30ccbe0d2b8b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Xethron/migrations-generator/zipball/a05bd7319ed808fcc3125212e37d30ccbe0d2b8b",
"reference": "a05bd7319ed808fcc3125212e37d30ccbe0d2b8b",
"shasum": ""
},
"require": {
"doctrine/dbal": "~2.4",
"illuminate/support": ">=4.1",
"php": ">=5.4.0",
"xethron/laravel-4-generators": "~3.1.0"
},
"require-dev": {
"illuminate/cache": ">=4.1.0",
"illuminate/console": ">=4.1.0",
"mockery/mockery": ">=0.9.0",
"phpunit/phpunit": ">=4.0.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Way\\Generators\\GeneratorsServiceProvider",
"Xethron\\MigrationsGenerator\\MigrationsGeneratorServiceProvider"
]
}
},
"autoload": {
"psr-0": {
"Xethron\\MigrationsGenerator": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Breytenbach",
"email": "bernhard@coffeecode.co.za"
}
],
"description": "Generates Laravel Migrations from an existing database",
"keywords": [
"artisan",
"generator",
"laravel",
"migration",
"migrations"
],
"time": "2017-09-19T17:31:57+00:00"
} }
], ],
"aliases": [], "aliases": [],
......
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Class CreateUsersTable.
*/
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password')->nullable();
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Class CreatePasswordResetsTable.
*/
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');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Class CreateSocialLoginsTable.
*/
class CreateSocialLoginsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('social_logins', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->string('provider', 32);
$table->string('provider_id');
$table->string('token')->nullable();
$table->string('avatar')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('social_logins');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Class SetupAccessTables.
*/
class SetupAccessTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table(config('access.users_table'), function ($table) {
$table->tinyInteger('status')->after('password')->default(1)->unsigned();
$table->string('confirmation_code')->after('status')->nullable();
$table->boolean('confirmed')->after('confirmation_code')->default(config('access.users.confirm_email') ? false : true);
$table->softDeletes();
});
Schema::create(config('access.roles_table'), function ($table) {
$table->increments('id')->unsigned();
$table->string('name');
$table->boolean('all')->default(false);
$table->smallInteger('sort')->default(0)->unsigned();
$table->timestamps();
/*
* Add Foreign/Unique/Index
*/
$table->unique('name');
});
Schema::create(config('access.role_user_table'), function ($table) {
$table->increments('id')->unsigned();
$table->integer('user_id')->unsigned();
$table->integer('role_id')->unsigned();
/*
* Add Foreign/Unique/Index
*/
$table->foreign('user_id')
->references('id')
->on(config('access.users_table'))
->onDelete('cascade');
$table->foreign('role_id')
->references('id')
->on(config('access.roles_table'))
->onDelete('cascade');
});
Schema::create(config('access.permissions_table'), function ($table) {
$table->increments('id')->unsigned();
$table->string('name');
$table->string('display_name');
$table->smallInteger('sort')->default(0)->unsigned();
$table->timestamps();
/*
* Add Foreign/Unique/Index
*/
$table->unique('name');
});
Schema::create(config('access.permission_role_table'), function ($table) {
$table->increments('id')->unsigned();
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
/*
* Add Foreign/Unique/Index
*/
$table->foreign('permission_id')
->references('id')
->on(config('access.permissions_table'))
->onDelete('cascade');
$table->foreign('role_id')
->references('id')
->on(config('access.roles_table'))
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table(config('access.users_table'), function (Blueprint $table) {
$table->dropColumn(['status', 'confirmed', 'confirmation_code', 'deleted_at']);
});
/*
* Remove Foreign/Unique/Index
*/
Schema::table(config('access.roles_table'), function (Blueprint $table) {
$table->dropUnique(config('access.roles_table').'_name_unique');
});
Schema::table(config('access.role_user_table'), function (Blueprint $table) {
$table->dropForeign(config('access.role_user_table').'_user_id_foreign');
$table->dropForeign(config('access.role_user_table').'_role_id_foreign');
});
Schema::table(config('access.permissions_table'), function (Blueprint $table) {
$table->dropUnique(config('access.permissions_table').'_name_unique');
});
Schema::table(config('access.permission_role_table'), function (Blueprint $table) {
$table->dropForeign(config('access.permission_role_table').'_permission_id_foreign');
$table->dropForeign(config('access.permission_role_table').'_role_id_foreign');
});
/*
* Drop tables
*/
Schema::dropIfExists(config('access.role_user_table'));
Schema::dropIfExists(config('access.permission_role_table'));
Schema::dropIfExists(config('access.roles_table'));
Schema::dropIfExists(config('access.permissions_table'));
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Class CreateHistoryTables.
*/
class CreateHistoryTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('history_types', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->string('name');
$table->timestamps();
});
Schema::create('history', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('type_id')->unsigned();
$table->integer('user_id')->unsigned();
$table->integer('entity_id')->unsigned()->nullable();
$table->string('icon')->nullable();
$table->string('class')->nullable();
$table->string('text');
$table->text('assets')->nullable();
$table->timestamps();
$table->foreign('type_id')
->references('id')
->on('history_types')
->onDelete('cascade');
$table->foreign('user_id')
->references('id')
->on(config('access.users_table'))
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('history', function (Blueprint $table) {
$table->dropForeign('history_type_id_foreign');
$table->dropForeign('history_user_id_foreign');
});
Schema::dropIfExists('history_types');
Schema::dropIfExists('history');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSessionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->unique();
$table->unsignedInteger('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');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCountriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('countries', function (Blueprint $table) {
$table->increments('id');
$table->string('country');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('countries');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateStatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('states', function (Blueprint $table) {
$table->increments('id');
$table->integer('country_id')->unsigned()->index();
$table->string('state');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('states');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCitiesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cities', function (Blueprint $table) {
$table->increments('id');
$table->integer('state_id')->unsigned()->index();
$table->string('city');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cities');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('name');
$table->string('first_name')->after('id');
$table->string('last_name')->after('first_name');
$table->text('address')->after('password');
$table->integer('country_id')->unsigned()->index()->after('address');
$table->integer('state_id')->unsigned()->index()->after('country_id');
$table->integer('city_id')->unsigned()->index()->after('state_id');
$table->string('zip_code')->after('city_id');
$table->string('ssn')->after('zip_code');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->string('name')->after('id');
$table->dropColumn('first_name')->after('id');
$table->dropColumn('last_name')->after('first_name');
$table->dropColumn('address')->after('password');
$table->dropColumn('country_id')->unsigned()->index()->after('address');
$table->dropColumn('state_id')->unsigned()->index()->after('country_id');
$table->dropColumn('city_id')->unsigned()->index()->after('state_id');
$table->dropColumn('zip_code')->after('city_id');
$table->dropColumn('ssn')->after('zip_code');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateUsersAddressField extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->text('address')->nullable()->default(null)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->text('address')->nullable(false)->change();
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCmsPagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cms_pages', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->string('title');
$table->string('page_slug')->unique();
$table->text('description')->nullable();
$table->string('cannonical_link');
$table->string('seo_title')->nullable();
$table->string('seo_keyword')->nullable();
$table->string('seo_description')->nullable();
$table->enum('is_active', ['Active', 'Inactive']);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cms_pages');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateCmspagesCannonicalLinkField extends Migration
{
/**
* Solution of enum data type.
*/
public function __construct()
{
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cms_pages', function (Blueprint $table) {
$table->string('cannonical_link')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cms_pages', function (Blueprint $table) {
$table->string('cannonical_link')->nullable(false)->change();
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDeletedAtFieldInTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('roles', function (Blueprint $table) {
$table->timestamp('deleted_at')->nullable();
});
Schema::table('permissions', function (Blueprint $table) {
$table->timestamp('deleted_at')->nullable();
});
Schema::table('cms_pages', function (Blueprint $table) {
$table->timestamp('deleted_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('roles', function (Blueprint $table) {
$table->dropColumn('deleted_at');
});
Schema::table('permissions', function (Blueprint $table) {
$table->dropColumn('deleted_at');
});
Schema::table('cms_pages', function (Blueprint $table) {
$table->dropColumn('deleted_at');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEmailTemplateTypesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_template_types', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('email_template_types');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEmailTemplatePlaceholdersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_template_placeholders', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('email_template_placeholders');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEmailTemplatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_templates', function (Blueprint $table) {
$table->increments('id');
$table->integer('type_id')->unsigned()->index();
$table->string('title', 255);
$table->string('subject', 255);
$table->text('body');
$table->tinyInteger('status')->default(1)->unsigned();
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
$table->timestamp('deleted_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('email_templates');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDefaultColumns extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
$table->dropColumn('deleted_at');
});
Schema::table('permissions', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
$table->dropColumn('deleted_at');
});
Schema::table('roles', function (Blueprint $table) {
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
$table->dropColumn('deleted_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
$table->timestamp('deleted_at')->nullable();
});
Schema::table('permissions', function (Blueprint $table) {
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
$table->timestamp('deleted_at')->nullable();
});
Schema::table('roles', function (Blueprint $table) {
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
$table->timestamp('deleted_at')->nullable();
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddAllDefaultColumns extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
$table->timestamp('deleted_at')->nullable();
});
Schema::table('permissions', function (Blueprint $table) {
$table->tinyInteger('status')->default(1)->unsigned();
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
$table->timestamp('deleted_at')->nullable();
});
Schema::table('roles', function (Blueprint $table) {
$table->tinyInteger('status')->default(1)->unsigned();
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
$table->timestamp('deleted_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('created_by');
$table->dropColumn('updated_by');
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
$table->dropColumn('deleted_at');
});
Schema::table('permissions', function (Blueprint $table) {
$table->dropColumn('status');
$table->dropColumn('created_by');
$table->dropColumn('updated_by');
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
$table->dropColumn('deleted_at');
});
Schema::table('roles', function (Blueprint $table) {
$table->dropColumn('status');
$table->dropColumn('created_by');
$table->dropColumn('updated_by');
$table->dropColumn('created_at');
$table->dropColumn('updated_at');
$table->dropColumn('deleted_at');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings', function (Blueprint $table) {
$table->increments('id');
$table->string('logo')->nullable();
$table->string('favicon')->nullable();
$table->string('seo_title')->nullable();
$table->text('seo_keyword')->nullable();
$table->text('seo_description')->nullable();
$table->string('company_contact')->nullable();
$table->text('company_address')->nullable();
$table->string('from_name')->nullable();
$table->string('from_email')->nullable();
$table->string('facebook')->nullable();
$table->string('linkedin')->nullable();
$table->string('twitter')->nullable();
$table->string('google')->nullable();
$table->string('copyright_text')->nullable();
$table->string('footer_text')->nullable();
$table->text('terms')->nullable();
$table->text('disclaimer')->nullable();
$table->text('google_analytics')->nullable();
$table->string('home_video1')->nullable();
$table->string('home_video2')->nullable();
$table->string('home_video3')->nullable();
$table->string('home_video4')->nullable();
$table->string('explanation1')->nullable();
$table->string('explanation2')->nullable();
$table->string('explanation3')->nullable();
$table->string('explanation4')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('settings');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatAllBlogTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blogs', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->dateTime('publish_datetime');
$table->string('featured_image');
$table->longText('content');
$table->integer('domain_id')->unsigned()->index();
$table->string('meta_title');
$table->string('cannonical_link');
$table->string('slug');
$table->text('meta_description');
$table->text('meta_keywords');
$table->enum('status', ['Published', 'Draft', 'InActive', 'Scheduled']);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
Schema::create('blog_tags', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->tinyInteger('status')->default(1)->unsigned();
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
Schema::create('blog_categories', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->tinyInteger('status')->default(1)->unsigned();
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
Schema::create('blog_map_categories', function (Blueprint $table) {
$table->increments('id');
$table->integer('blog_id')->unsigned()->index();
$table->integer('category_id')->unsigned()->index();
});
Schema::create('blog_map_tags', function (Blueprint $table) {
$table->increments('id');
$table->integer('blog_id')->unsigned()->index();
$table->integer('tag_id')->unsigned()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('blog_map_tags');
Schema::dropIfExists('blog_map_categories');
Schema::dropIfExists('blog_categories');
Schema::dropIfExists('blog_tags');
Schema::dropIfExists('blogs');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddNullableToBlogFields extends Migration
{
/**
* Solution of enum data type.
*/
public function __construct()
{
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('blogs', function (Blueprint $table) {
$table->dropColumn('domain_id');
$table->string('meta_title')->nullable()->change();
$table->string('cannonical_link')->nullable()->change();
$table->string('slug')->nullable()->change();
$table->text('meta_description')->nullable()->change();
$table->text('meta_keywords')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('blogs', function (Blueprint $table) {
$table->integer('domain_id')->unsigned()->index()->after('featured_image');
$table->string('meta_title')->change();
$table->string('cannonical_link')->change();
$table->string('slug')->change();
$table->text('meta_description')->change();
$table->text('meta_keywords')->change();
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ChangeCmsPagesIsActiveToStatus extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cms_pages', function (Blueprint $table) {
$table->tinyInteger('status')->default(1)->unsigned()
->after('seo_description');
$table->dropColumn('is_active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cms_pages', function (Blueprint $table) {
$table->dropColumn('status');
$table->enum('is_active', ['Active', 'Inactive'])
->after('seo_description');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddStateCodeFieldInStatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('states', function (Blueprint $table) {
$table->string('state_code')->after('state');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('states', function (Blueprint $table) {
$table->dropColumn('state_code');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ChangeSeoDescriptionFieldInCmspages extends Migration
{
/**
* Solution of enum data type.
*/
public function __construct()
{
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cms_pages', function (Blueprint $table) {
$table->text('seo_description')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cms_pages', function (Blueprint $table) {
$table->string('seo_description')->nullable()->change();
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIsTermAcceptedInUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->tinyInteger('is_term_accept')->default(0)->after('confirmed')->comment = ' 0 = not accepted,1 = accepted';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('is_term_accept');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFaqsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//Creating FAQ's table
Schema::create('faqs', function (Blueprint $table) {
$table->increments('id');
$table->string('question');
$table->text('answer');
$table->tinyInteger('status')->default(0)->unsigned();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('faqs');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePermissionUserTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('access.permission_user_table'), function ($table) {
$table->increments('id')->unsigned();
$table->integer('permission_id')->unsigned();
$table->integer('user_id')->unsigned();
/*
* Add Foreign/Unique/Index
*/
$table->foreign('permission_id')
->references('id')
->on(config('access.permissions_table'))
->onDelete('cascade');
$table->foreign('user_id')
->references('id')
->on(config('access.users_table'))
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table(config('access.permission_user_table'), function (Blueprint $table) {
$table->dropForeign(config('access.permission_user_table').'_permission_id_foreign');
$table->dropForeign(config('access.permission_user_table').'_user_id_foreign');
});
Schema::drop(config('access.permission_user_table'));
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->string('message');
$table->integer('user_id')->unsigned();
$table->tinyInteger('type')->default(1)->comment('1 - Dashboard , 2 - Email , 3 - Both');
$table->unsignedTinyInteger('is_read')->default(0);
$table->timestamps();
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateMenusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('menus', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->enum('type', ['backend', 'frontend']);
$table->string('name');
$table->text('items')->nullable();
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('menus');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateModulesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('modules', function (Blueprint $table) {
$table->increments('id');
$table->string('view_permission_id');
$table->string('name');
$table->string('url')->nullable()->comment('view_route');
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('modules');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBlogCategoriesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blog_categories', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 191);
$table->boolean('status')->default(1);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('blog_categories');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBlogMapCategoriesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blog_map_categories', function(Blueprint $table)
{
$table->increments('id');
$table->integer('blog_id')->unsigned()->index();
$table->integer('category_id')->unsigned()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('blog_map_categories');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBlogMapTagsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blog_map_tags', function(Blueprint $table)
{
$table->increments('id');
$table->integer('blog_id')->unsigned()->index();
$table->integer('tag_id')->unsigned()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('blog_map_tags');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBlogTagsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blog_tags', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 191);
$table->boolean('status')->default(1);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('blog_tags');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBlogsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blogs', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 191);
$table->dateTime('publish_datetime');
$table->string('featured_image', 191);
$table->text('content');
$table->string('meta_title', 191)->nullable();
$table->string('cannonical_link', 191)->nullable();
$table->string('slug', 191)->nullable();
$table->text('meta_description', 65535)->nullable();
$table->text('meta_keywords', 65535)->nullable();
$table->enum('status', array('Published','Draft','InActive','Scheduled'));
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('blogs');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCitiesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cities', function(Blueprint $table)
{
$table->increments('id');
$table->integer('state_id')->unsigned()->index();
$table->string('city', 191);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('cities');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCmsPagesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cms_pages', function(Blueprint $table)
{
$table->increments('id');
$table->string('title', 191);
$table->string('page_slug', 191)->unique();
$table->text('description', 65535)->nullable();
$table->string('cannonical_link', 191)->nullable();
$table->string('seo_title', 191)->nullable();
$table->string('seo_keyword', 191)->nullable();
$table->text('seo_description', 65535)->nullable();
$table->boolean('status')->default(1);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('cms_pages');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCountriesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('countries', function(Blueprint $table)
{
$table->increments('id');
$table->string('country', 191);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('countries');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEmailTemplatePlaceholdersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_template_placeholders', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 191);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('email_template_placeholders');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEmailTemplateTypesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_template_types', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 191);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('email_template_types');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEmailTemplatesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_templates', function(Blueprint $table)
{
$table->increments('id');
$table->integer('type_id')->unsigned()->index();
$table->string('title');
$table->string('subject');
$table->text('body', 65535);
$table->boolean('status')->default(1);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('email_templates');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFaqsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('faqs', function(Blueprint $table)
{
$table->increments('id');
$table->string('question', 191);
$table->text('answer', 65535);
$table->boolean('status')->default(0);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('faqs');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateHistoryTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('history', function(Blueprint $table)
{
$table->increments('id');
$table->integer('type_id')->unsigned()->index('history_type_id_foreign');
$table->integer('user_id')->unsigned()->index('history_user_id_foreign');
$table->integer('entity_id')->unsigned()->nullable();
$table->string('icon', 191)->nullable();
$table->string('class', 191)->nullable();
$table->string('text', 191);
$table->text('assets', 65535)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('history');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateHistoryTypesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('history_types', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 191);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('history_types');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMenusTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('menus', function(Blueprint $table)
{
$table->increments('id');
$table->enum('type', array('backend','frontend'));
$table->string('name', 191);
$table->text('items', 65535)->nullable();
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('menus');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateModulesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('modules', function(Blueprint $table)
{
$table->increments('id');
$table->string('view_permission_id', 191);
$table->string('name', 191);
$table->string('url', 191)->nullable()->comment('view_route');
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('modules');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateNotificationsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function(Blueprint $table)
{
$table->increments('id');
$table->string('message', 191);
$table->integer('user_id')->unsigned()->index('notifications_user_id_foreign');
$table->boolean('type')->default(1)->comment('1 - Dashboard , 2 - Email , 3 - Both');
$table->boolean('is_read')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('notifications');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePasswordResetsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function(Blueprint $table)
{
$table->string('email', 191)->index();
$table->string('token', 191);
$table->dateTime('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('password_resets');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePermissionRoleTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permission_role', function(Blueprint $table)
{
$table->increments('id');
$table->integer('permission_id')->unsigned()->index('permission_role_permission_id_foreign');
$table->integer('role_id')->unsigned()->index('permission_role_role_id_foreign');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('permission_role');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePermissionUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permission_user', function(Blueprint $table)
{
$table->increments('id');
$table->integer('permission_id')->unsigned()->index('permission_user_permission_id_foreign');
$table->integer('user_id')->unsigned()->index('permission_user_user_id_foreign');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('permission_user');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePermissionsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permissions', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 191)->unique();
$table->string('display_name', 191);
$table->smallInteger('sort')->unsigned()->default(0);
$table->boolean('status')->default(1);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('permissions');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateRoleUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('role_user', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index('role_user_user_id_foreign');
$table->integer('role_id')->unsigned()->index('role_user_role_id_foreign');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('role_user');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateRolesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('roles', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 191)->unique();
$table->boolean('all')->default(0);
$table->smallInteger('sort')->unsigned()->default(0);
$table->boolean('status')->default(1);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('roles');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSessionsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function(Blueprint $table)
{
$table->string('id', 191)->unique();
$table->integer('user_id')->unsigned()->nullable();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent', 65535)->nullable();
$table->text('payload', 65535);
$table->integer('last_activity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('sessions');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSettingsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings', function(Blueprint $table)
{
$table->increments('id');
$table->string('logo', 191)->nullable();
$table->string('favicon', 191)->nullable();
$table->string('seo_title', 191)->nullable();
$table->text('seo_keyword', 65535)->nullable();
$table->text('seo_description', 65535)->nullable();
$table->string('company_contact', 191)->nullable();
$table->text('company_address', 65535)->nullable();
$table->string('from_name', 191)->nullable();
$table->string('from_email', 191)->nullable();
$table->string('facebook', 191)->nullable();
$table->string('linkedin', 191)->nullable();
$table->string('twitter', 191)->nullable();
$table->string('google', 191)->nullable();
$table->string('copyright_text', 191)->nullable();
$table->string('footer_text', 191)->nullable();
$table->text('terms', 65535)->nullable();
$table->text('disclaimer', 65535)->nullable();
$table->text('google_analytics', 65535)->nullable();
$table->string('home_video1', 191)->nullable();
$table->string('home_video2', 191)->nullable();
$table->string('home_video3', 191)->nullable();
$table->string('home_video4', 191)->nullable();
$table->string('explanation1', 191)->nullable();
$table->string('explanation2', 191)->nullable();
$table->string('explanation3', 191)->nullable();
$table->string('explanation4', 191)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('settings');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSocialLoginsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('social_logins', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index('social_logins_user_id_foreign');
$table->string('provider', 32);
$table->string('provider_id', 191);
$table->string('token', 191)->nullable();
$table->string('avatar', 191)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('social_logins');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateStatesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('states', function(Blueprint $table)
{
$table->increments('id');
$table->integer('country_id')->unsigned()->index();
$table->string('state', 191);
$table->string('state_code', 191);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('states');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
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', 191);
$table->string('last_name', 191);
$table->string('email', 191)->unique();
$table->string('password', 191)->nullable();
$table->text('address', 65535)->nullable();
$table->integer('country_id')->unsigned()->index();
$table->integer('state_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->string('zip_code', 191);
$table->string('ssn', 191);
$table->boolean('status')->default(1);
$table->string('confirmation_code', 191)->nullable();
$table->boolean('confirmed')->default(0);
$table->boolean('is_term_accept')->default(0)->comment(' 0 = not accepted,1 = accepted');
$table->string('remember_token', 100)->nullable();
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToHistoryTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('history', function(Blueprint $table)
{
$table->foreign('type_id')->references('id')->on('history_types')->onUpdate('RESTRICT')->onDelete('CASCADE');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('history', function(Blueprint $table)
{
$table->dropForeign('history_type_id_foreign');
$table->dropForeign('history_user_id_foreign');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToNotificationsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('notifications', function(Blueprint $table)
{
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('notifications', function(Blueprint $table)
{
$table->dropForeign('notifications_user_id_foreign');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToPermissionRoleTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('permission_role', function(Blueprint $table)
{
$table->foreign('permission_id')->references('id')->on('permissions')->onUpdate('RESTRICT')->onDelete('CASCADE');
$table->foreign('role_id')->references('id')->on('roles')->onUpdate('RESTRICT')->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('permission_role', function(Blueprint $table)
{
$table->dropForeign('permission_role_permission_id_foreign');
$table->dropForeign('permission_role_role_id_foreign');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToPermissionUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('permission_user', function(Blueprint $table)
{
$table->foreign('permission_id')->references('id')->on('permissions')->onUpdate('RESTRICT')->onDelete('CASCADE');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('permission_user', function(Blueprint $table)
{
$table->dropForeign('permission_user_permission_id_foreign');
$table->dropForeign('permission_user_user_id_foreign');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToRoleUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('role_user', function(Blueprint $table)
{
$table->foreign('role_id')->references('id')->on('roles')->onUpdate('RESTRICT')->onDelete('CASCADE');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('role_user', function(Blueprint $table)
{
$table->dropForeign('role_user_role_id_foreign');
$table->dropForeign('role_user_user_id_foreign');
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToSocialLoginsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('social_logins', function(Blueprint $table)
{
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('social_logins', function(Blueprint $table)
{
$table->dropForeign('social_logins_user_id_foreign');
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment