From 2c1a6dc7c7b14d572076c2cdbcd6fcb944bbca14 Mon Sep 17 00:00:00 2001 From: Kamieljv Date: Wed, 3 Nov 2021 12:39:04 +0100 Subject: [PATCH] Added seeders and migrations to keep up with Voyager changes --- README.md | 97 ++----------- app/Event.php | 11 ++ composer.json | 2 + composer.lock | 137 +++++++++++++++++- config/voyager.php | 6 +- ..._113304_create_announcement_user_table.php | 31 ++++ ...1_03_113304_create_announcements_table.php | 34 +++++ ...021_11_03_113304_create_api_keys_table.php | 35 +++++ ...1_11_03_113304_create_categories_table.php | 35 +++++ ...21_11_03_113304_create_data_rows_table.php | 42 ++++++ ...1_11_03_113304_create_data_types_table.php | 43 ++++++ .../2021_11_03_113304_create_events_table.php | 34 +++++ ...1_11_03_113304_create_menu_items_table.php | 41 ++++++ .../2021_11_03_113304_create_menus_table.php | 32 ++++ ...1_03_113304_create_notifications_table.php | 38 +++++ ...3304_create_paddle_subscriptions_table.php | 38 +++++ .../2021_11_03_113304_create_pages_table.php | 40 +++++ ...03_113304_create_password_resets_table.php | 32 ++++ ..._113304_create_permission_groups_table.php | 31 ++++ ...03_113304_create_permission_role_table.php | 33 +++++ ..._11_03_113304_create_permissions_table.php | 34 +++++ .../2021_11_03_113304_create_plans_table.php | 40 +++++ .../2021_11_03_113304_create_posts_table.php | 43 ++++++ .../2021_11_03_113304_create_roles_table.php | 33 +++++ ...021_11_03_113304_create_settings_table.php | 37 +++++ ...1_03_113304_create_theme_options_table.php | 34 +++++ .../2021_11_03_113304_create_themes_table.php | 35 +++++ ...11_03_113304_create_translations_table.php | 38 +++++ ...1_11_03_113304_create_user_roles_table.php | 33 +++++ .../2021_11_03_113304_create_users_table.php | 46 ++++++ ...03_113304_create_wave_key_values_table.php | 37 +++++ ...oreign_keys_to_announcement_user_table.php | 34 +++++ ...5_add_foreign_keys_to_categories_table.php | 32 ++++ ...05_add_foreign_keys_to_data_rows_table.php | 32 ++++ ...5_add_foreign_keys_to_menu_items_table.php | 32 ++++ ..._foreign_keys_to_permission_role_table.php | 34 +++++ ...113305_add_foreign_keys_to_plans_table.php | 32 ++++ ...dd_foreign_keys_to_theme_options_table.php | 32 ++++ ...5_add_foreign_keys_to_user_roles_table.php | 34 +++++ ...113305_add_foreign_keys_to_users_table.php | 32 ++++ database/seeders/DatabaseSeeder.php | 1 + database/seeders/EventsTableSeeder.php | 24 +++ 42 files changed, 1431 insertions(+), 90 deletions(-) create mode 100644 app/Event.php create mode 100644 database/migrations/2021_11_03_113304_create_announcement_user_table.php create mode 100644 database/migrations/2021_11_03_113304_create_announcements_table.php create mode 100644 database/migrations/2021_11_03_113304_create_api_keys_table.php create mode 100644 database/migrations/2021_11_03_113304_create_categories_table.php create mode 100644 database/migrations/2021_11_03_113304_create_data_rows_table.php create mode 100644 database/migrations/2021_11_03_113304_create_data_types_table.php create mode 100644 database/migrations/2021_11_03_113304_create_events_table.php create mode 100644 database/migrations/2021_11_03_113304_create_menu_items_table.php create mode 100644 database/migrations/2021_11_03_113304_create_menus_table.php create mode 100644 database/migrations/2021_11_03_113304_create_notifications_table.php create mode 100644 database/migrations/2021_11_03_113304_create_paddle_subscriptions_table.php create mode 100644 database/migrations/2021_11_03_113304_create_pages_table.php create mode 100644 database/migrations/2021_11_03_113304_create_password_resets_table.php create mode 100644 database/migrations/2021_11_03_113304_create_permission_groups_table.php create mode 100644 database/migrations/2021_11_03_113304_create_permission_role_table.php create mode 100644 database/migrations/2021_11_03_113304_create_permissions_table.php create mode 100644 database/migrations/2021_11_03_113304_create_plans_table.php create mode 100644 database/migrations/2021_11_03_113304_create_posts_table.php create mode 100644 database/migrations/2021_11_03_113304_create_roles_table.php create mode 100644 database/migrations/2021_11_03_113304_create_settings_table.php create mode 100644 database/migrations/2021_11_03_113304_create_theme_options_table.php create mode 100644 database/migrations/2021_11_03_113304_create_themes_table.php create mode 100644 database/migrations/2021_11_03_113304_create_translations_table.php create mode 100644 database/migrations/2021_11_03_113304_create_user_roles_table.php create mode 100644 database/migrations/2021_11_03_113304_create_users_table.php create mode 100644 database/migrations/2021_11_03_113304_create_wave_key_values_table.php create mode 100644 database/migrations/2021_11_03_113305_add_foreign_keys_to_announcement_user_table.php create mode 100644 database/migrations/2021_11_03_113305_add_foreign_keys_to_categories_table.php create mode 100644 database/migrations/2021_11_03_113305_add_foreign_keys_to_data_rows_table.php create mode 100644 database/migrations/2021_11_03_113305_add_foreign_keys_to_menu_items_table.php create mode 100644 database/migrations/2021_11_03_113305_add_foreign_keys_to_permission_role_table.php create mode 100644 database/migrations/2021_11_03_113305_add_foreign_keys_to_plans_table.php create mode 100644 database/migrations/2021_11_03_113305_add_foreign_keys_to_theme_options_table.php create mode 100644 database/migrations/2021_11_03_113305_add_foreign_keys_to_user_roles_table.php create mode 100644 database/migrations/2021_11_03_113305_add_foreign_keys_to_users_table.php create mode 100644 database/seeders/EventsTableSeeder.php diff --git a/README.md b/README.md index 7dc34a1f..9d359993 100644 --- a/README.md +++ b/README.md @@ -1,95 +1,20 @@ -

+# Deployment Instructions -

+## Migrating +- Generate migrations for all tables -## Introduction +`php artisan migrate:generate` -[Wave](https://devdojo.com/wave) is a Software as a Service Starter Kit that can help you build your next great idea 💰. Wave is built with [Laravel](https://laravel.com), [Voyager](https://voyager.devdojo.com), [TailwindCSS](https://tailwindcss.com), and a few other awesome technologies. Here are some of the awesome features ✨: +- Or for one - - [Authentication](https://wave.devdojo.com/docs/features/authentication) - - [User Profiles](https://wave.devdojo.com/docs/features/user-profiles) - - [User Impersonation](https://wave.devdojo.com/docs/features/user-impersonation) - - [Subscriptions](https://wave.devdojo.com/docs/features/billing) - - [Subscription Plans](https://wave.devdojo.com/docs/features/subscription-plans) - - [User Roles](https://wave.devdojo.com/docs/features/user-roles) - - [Notifications](https://wave.devdojo.com/docs/features/notifications) - - [Announcements](https://wave.devdojo.com/docs/features/announcements) - - [Fully Functional Blog](https://wave.devdojo.com/docs/features/blog) - - [Out of the Box API](https://wave.devdojo.com/docs/features/api) - - [Voyager Admin](https://wave.devdojo.com/docs/features/admin) - - [Customizable Themes](https://wave.devdojo.com/docs/features/themes) +`php artisan migrate:generate --tables="my_table"` -## Demo -View a live [demo here](https://wave.devdojo.com), or deploy your own instance to DigitalOcean, by clicking the button below. +## Seeding +- Generate seeders -Deploy to DO +`php artisan iseed my_table` +- Run seeders -## Installation - -To install Wave, you'll want to clone or download this repo: - -``` -git clone https://github.com/thedevdojo/wave.git project_name -``` - -Next, we can install Wave with these **4 simple steps**: - -### 1. Create a New Database - -During the installation we need to use a MySQL database. You will need to create a new database and save the credentials for the next step. - -### 2. Copy the `.env.example` file - -We need to specify our Environment variables for our application. You will see a file named `.env.example`, you will need to duplicate that file and rename it to `.env`. - -Then, open up the `.env` file and update your *DB_DATABASE*, *DB_USERNAME*, and *DB_PASSWORD* in the appropriate fields. You will also want to update the *APP_URL* to the URL of your application. - -```bash -APP_URL=http://wave.test - -DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_DATABASE=wave -DB_USERNAME=root -DB_PASSWORD= -``` - - -### 3. Add Composer Dependencies - -Next, we will need to install all our composer dependencies by running the following command: - -```php -composer install -``` -### 4. Run Migrations and Seeds - -We need to migrate our database structure into our database, which we can do by running: - -```php -php artisan migrate -``` -
-Finally, we will need to seed our database with the following command: - -```php -php artisan db:seed -``` -
- -🎉 And that's it! You will now be able to visit your URL and see your Wave application up and running. - - -## Watch, Learn, and Build - -We've also got a full video series on how you can setup, build, and configure Wave. 🍿 You can watch first few videos for free, and additional videos will require a [DevDojo Pro](https://devdojo.com/pro) subscription. By subscribing to a [DevDojo Pro](https://devdojo.com/pro) subscription you will also be supporting the ongoing development of this project. It's a win win! 🙌 - -[Click here to watch the Wave Video Series](https://devdojo.com/course/wave). - - -## Documentation - -Checkout the [official documentation here](https://wave.devdojo.com/docs). +`php artisan db:seed` diff --git a/app/Event.php b/app/Event.php new file mode 100644 index 00000000..59c87c82 --- /dev/null +++ b/app/Event.php @@ -0,0 +1,11 @@ +=7.1.3" + }, + "require-dev": { + "ext-pdo": "*", + "friendsofphp/php-cs-fixer": "^2.19.0|^3.1", + "mockery/mockery": "^1.0", + "nunomaduro/larastan": "^0.4|^0.5|^0.6|^0.7", + "orchestra/testbench": "^3.6|^4.0|^5.0|^6.0", + "phpmd/phpmd": "^2.10", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "MigrationsGenerator\\MigrationsGeneratorServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "MigrationsGenerator\\": "src/MigrationsGenerator" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kit Loong", + "email": "kitloong1008@gmail.com" + } + ], + "description": "Generates Laravel Migrations from an existing database", + "keywords": [ + "artisan", + "generator", + "laravel", + "lumen", + "migration", + "migrations" + ], + "support": { + "issues": "https://github.com/kitloong/laravel-migrations-generator/issues", + "source": "https://github.com/kitloong/laravel-migrations-generator/tree/v5.0.1" + }, + "funding": [ + { + "url": "https://www.buymeacoffee.com/kitloong", + "type": "custom" + } + ], + "time": "2021-09-29T13:33:48+00:00" + }, { "name": "laravel/dusk", "version": "v6.18.1", diff --git a/config/voyager.php b/config/voyager.php index 87d05723..78e9d15b 100644 --- a/config/voyager.php +++ b/config/voyager.php @@ -12,7 +12,7 @@ 'user' => [ 'add_default_role_on_register' => true, - 'default_role' => 'trial', + 'default_role' => 'user', 'namespace' => App\User::class, 'default_avatar' => 'users/default.png', ], @@ -129,14 +129,14 @@ /* * Select default language */ - 'default' => 'en', + 'default' => 'nl', /* * Select languages that are supported. */ 'locales' => [ + 'nl', 'en', - //'pt', ], ], diff --git a/database/migrations/2021_11_03_113304_create_announcement_user_table.php b/database/migrations/2021_11_03_113304_create_announcement_user_table.php new file mode 100644 index 00000000..d9b0e4c8 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_announcement_user_table.php @@ -0,0 +1,31 @@ +unsignedInteger('announcement_id')->index(); + $table->unsignedBigInteger('user_id')->index(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('announcement_user'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_announcements_table.php b/database/migrations/2021_11_03_113304_create_announcements_table.php new file mode 100644 index 00000000..0bc6073f --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_announcements_table.php @@ -0,0 +1,34 @@ +increments('id'); + $table->string('title')->default(''); + $table->string('description'); + $table->text('body'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('announcements'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_api_keys_table.php b/database/migrations/2021_11_03_113304_create_api_keys_table.php new file mode 100644 index 00000000..47ce8194 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_api_keys_table.php @@ -0,0 +1,35 @@ +increments('id'); + $table->unsignedInteger('user_id'); + $table->string('name'); + $table->string('key', 60)->default('')->unique('api_tokens_token_unique'); + $table->dateTime('last_used_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('api_keys'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_categories_table.php b/database/migrations/2021_11_03_113304_create_categories_table.php new file mode 100644 index 00000000..f12f9578 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_categories_table.php @@ -0,0 +1,35 @@ +increments('id'); + $table->unsignedInteger('parent_id')->nullable()->index('categories_parent_id_foreign'); + $table->integer('order')->default(1); + $table->string('name'); + $table->string('slug')->unique(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('categories'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_data_rows_table.php b/database/migrations/2021_11_03_113304_create_data_rows_table.php new file mode 100644 index 00000000..6d4723e7 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_data_rows_table.php @@ -0,0 +1,42 @@ +increments('id'); + $table->unsignedInteger('data_type_id')->index('data_rows_data_type_id_foreign'); + $table->string('field'); + $table->string('type'); + $table->string('display_name'); + $table->boolean('required')->default(false); + $table->boolean('browse')->default(true); + $table->boolean('read')->default(true); + $table->boolean('edit')->default(true); + $table->boolean('add')->default(true); + $table->boolean('delete')->default(true); + $table->text('details')->nullable(); + $table->integer('order')->default(1); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('data_rows'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_data_types_table.php b/database/migrations/2021_11_03_113304_create_data_types_table.php new file mode 100644 index 00000000..5fde51e3 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_data_types_table.php @@ -0,0 +1,43 @@ +increments('id'); + $table->string('name')->unique(); + $table->string('slug')->unique(); + $table->string('display_name_singular'); + $table->string('display_name_plural'); + $table->string('icon')->nullable(); + $table->string('model_name')->nullable(); + $table->string('policy_name')->nullable(); + $table->string('controller')->nullable(); + $table->string('description')->nullable(); + $table->boolean('generate_permissions')->default(false); + $table->tinyInteger('server_side')->default(0); + $table->text('details')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('data_types'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_events_table.php b/database/migrations/2021_11_03_113304_create_events_table.php new file mode 100644 index 00000000..7cb2c804 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_events_table.php @@ -0,0 +1,34 @@ +increments('id'); + $table->string('title', 255)->unique(); + $table->text('excerpt')->nullable(); + $table->text('description')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('events'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_menu_items_table.php b/database/migrations/2021_11_03_113304_create_menu_items_table.php new file mode 100644 index 00000000..89e8fe9b --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_menu_items_table.php @@ -0,0 +1,41 @@ +increments('id'); + $table->unsignedInteger('menu_id')->nullable()->index('menu_items_menu_id_foreign'); + $table->string('title'); + $table->string('url'); + $table->string('target')->default('_self'); + $table->string('icon_class')->nullable(); + $table->string('color')->nullable(); + $table->integer('parent_id')->nullable(); + $table->integer('order'); + $table->timestamps(); + $table->string('route')->nullable(); + $table->text('parameters')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('menu_items'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_menus_table.php b/database/migrations/2021_11_03_113304_create_menus_table.php new file mode 100644 index 00000000..4cf5862f --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_menus_table.php @@ -0,0 +1,32 @@ +increments('id'); + $table->string('name')->unique(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('menus'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_notifications_table.php b/database/migrations/2021_11_03_113304_create_notifications_table.php new file mode 100644 index 00000000..4d02076f --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_notifications_table.php @@ -0,0 +1,38 @@ +char('id', 36)->primary(); + $table->string('type'); + $table->unsignedInteger('notifiable_id'); + $table->string('notifiable_type'); + $table->text('data'); + $table->dateTime('read_at')->nullable(); + $table->timestamps(); + + $table->index(['notifiable_id', 'notifiable_type']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('notifications'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_paddle_subscriptions_table.php b/database/migrations/2021_11_03_113304_create_paddle_subscriptions_table.php new file mode 100644 index 00000000..e399ce42 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_paddle_subscriptions_table.php @@ -0,0 +1,38 @@ +bigIncrements('id'); + $table->unsignedInteger('subscription_id')->unique(); + $table->integer('plan_id')->nullable(); + $table->integer('user_id')->nullable(); + $table->string('status')->nullable(); + $table->string('update_url')->nullable(); + $table->string('cancel_url')->nullable(); + $table->dateTime('cancelled_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('paddle_subscriptions'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_pages_table.php b/database/migrations/2021_11_03_113304_create_pages_table.php new file mode 100644 index 00000000..8e13b7ba --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_pages_table.php @@ -0,0 +1,40 @@ +increments('id'); + $table->integer('author_id'); + $table->string('title'); + $table->text('excerpt')->nullable(); + $table->text('body')->nullable(); + $table->string('image')->nullable(); + $table->string('slug')->unique(); + $table->text('meta_description')->nullable(); + $table->text('meta_keywords')->nullable(); + $table->enum('status', ['ACTIVE', 'INACTIVE'])->default('INACTIVE'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('pages'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_password_resets_table.php b/database/migrations/2021_11_03_113304_create_password_resets_table.php new file mode 100644 index 00000000..0ee0a36a --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_password_resets_table.php @@ -0,0 +1,32 @@ +string('email')->index(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('password_resets'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_permission_groups_table.php b/database/migrations/2021_11_03_113304_create_permission_groups_table.php new file mode 100644 index 00000000..003986e7 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_permission_groups_table.php @@ -0,0 +1,31 @@ +increments('id'); + $table->string('name')->unique(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('permission_groups'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_permission_role_table.php b/database/migrations/2021_11_03_113304_create_permission_role_table.php new file mode 100644 index 00000000..b8a4c666 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_permission_role_table.php @@ -0,0 +1,33 @@ +unsignedBigInteger('permission_id')->index(); + $table->unsignedBigInteger('role_id')->index(); + + $table->primary(['permission_id', 'role_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('permission_role'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_permissions_table.php b/database/migrations/2021_11_03_113304_create_permissions_table.php new file mode 100644 index 00000000..26687b1d --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_permissions_table.php @@ -0,0 +1,34 @@ +bigIncrements('id'); + $table->string('key')->index(); + $table->string('table_name')->nullable(); + $table->timestamps(); + $table->unsignedInteger('permission_group_id')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('permissions'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_plans_table.php b/database/migrations/2021_11_03_113304_create_plans_table.php new file mode 100644 index 00000000..b5b550f4 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_plans_table.php @@ -0,0 +1,40 @@ +increments('id'); + $table->string('name'); + $table->string('slug')->unique(); + $table->text('description')->nullable(); + $table->string('features'); + $table->string('plan_id')->default(''); + $table->unsignedBigInteger('role_id')->index('plans_role_id_foreign'); + $table->boolean('default')->default(false); + $table->string('price'); + $table->integer('trial_days')->default(0); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('plans'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_posts_table.php b/database/migrations/2021_11_03_113304_create_posts_table.php new file mode 100644 index 00000000..99a8b341 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_posts_table.php @@ -0,0 +1,43 @@ +increments('id'); + $table->integer('author_id'); + $table->integer('category_id')->nullable(); + $table->string('title'); + $table->string('seo_title')->nullable(); + $table->text('excerpt')->nullable(); + $table->text('body'); + $table->string('image')->nullable(); + $table->string('slug')->unique(); + $table->text('meta_description')->nullable(); + $table->text('meta_keywords')->nullable(); + $table->enum('status', ['PUBLISHED', 'DRAFT', 'PENDING'])->default('DRAFT'); + $table->boolean('featured')->default(false); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('posts'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_roles_table.php b/database/migrations/2021_11_03_113304_create_roles_table.php new file mode 100644 index 00000000..d75f1136 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_roles_table.php @@ -0,0 +1,33 @@ +bigIncrements('id'); + $table->string('name')->unique(); + $table->string('display_name'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('roles'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_settings_table.php b/database/migrations/2021_11_03_113304_create_settings_table.php new file mode 100644 index 00000000..eff08ec4 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_settings_table.php @@ -0,0 +1,37 @@ +increments('id'); + $table->string('key')->unique(); + $table->string('display_name'); + $table->text('value')->nullable(); + $table->text('details')->nullable(); + $table->string('type'); + $table->integer('order')->default(1); + $table->string('group')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('settings'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_theme_options_table.php b/database/migrations/2021_11_03_113304_create_theme_options_table.php new file mode 100644 index 00000000..18aa62cd --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_theme_options_table.php @@ -0,0 +1,34 @@ +increments('id'); + $table->unsignedInteger('theme_id')->index('voyager_theme_options_theme_id_index'); + $table->string('key'); + $table->text('value')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('theme_options'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_themes_table.php b/database/migrations/2021_11_03_113304_create_themes_table.php new file mode 100644 index 00000000..fd08eb93 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_themes_table.php @@ -0,0 +1,35 @@ +increments('id'); + $table->string('name'); + $table->string('folder')->unique('voyager_themes_folder_unique'); + $table->boolean('active')->default(false); + $table->string('version')->default(''); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('themes'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_translations_table.php b/database/migrations/2021_11_03_113304_create_translations_table.php new file mode 100644 index 00000000..bf7faf94 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_translations_table.php @@ -0,0 +1,38 @@ +increments('id'); + $table->string('table_name'); + $table->string('column_name'); + $table->unsignedInteger('foreign_key'); + $table->string('locale'); + $table->text('value'); + $table->timestamps(); + + $table->unique(['table_name', 'column_name', 'foreign_key', 'locale']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('translations'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_user_roles_table.php b/database/migrations/2021_11_03_113304_create_user_roles_table.php new file mode 100644 index 00000000..9ea9d8ae --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_user_roles_table.php @@ -0,0 +1,33 @@ +unsignedBigInteger('user_id')->index(); + $table->unsignedBigInteger('role_id')->index(); + + $table->primary(['user_id', 'role_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('user_roles'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_users_table.php b/database/migrations/2021_11_03_113304_create_users_table.php new file mode 100644 index 00000000..4ffbd28f --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_users_table.php @@ -0,0 +1,46 @@ +bigIncrements('id'); + $table->unsignedBigInteger('role_id')->nullable()->index('users_role_id_foreign'); + $table->string('name'); + $table->string('email')->unique(); + $table->string('avatar')->nullable()->default('users/default.png'); + $table->timestamp('email_verified_at')->nullable(); + $table->string('password'); + $table->rememberToken(); + $table->text('settings')->nullable(); + $table->timestamps(); + $table->string('username')->unique(); + $table->string('stripe_id')->nullable(); + $table->string('card_brand')->nullable(); + $table->string('card_last_four')->nullable(); + $table->dateTime('trial_ends_at')->nullable(); + $table->string('verification_code')->nullable(); + $table->boolean('verified')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('users'); + } +} diff --git a/database/migrations/2021_11_03_113304_create_wave_key_values_table.php b/database/migrations/2021_11_03_113304_create_wave_key_values_table.php new file mode 100644 index 00000000..86f37638 --- /dev/null +++ b/database/migrations/2021_11_03_113304_create_wave_key_values_table.php @@ -0,0 +1,37 @@ +increments('id'); + $table->string('type'); + $table->unsignedInteger('keyvalue_id'); + $table->string('keyvalue_type'); + $table->string('key'); + $table->string('value'); + + $table->unique(['keyvalue_id', 'keyvalue_type', 'key']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('wave_key_values'); + } +} diff --git a/database/migrations/2021_11_03_113305_add_foreign_keys_to_announcement_user_table.php b/database/migrations/2021_11_03_113305_add_foreign_keys_to_announcement_user_table.php new file mode 100644 index 00000000..4549f6b5 --- /dev/null +++ b/database/migrations/2021_11_03_113305_add_foreign_keys_to_announcement_user_table.php @@ -0,0 +1,34 @@ +foreign(['announcement_id'])->references(['id'])->on('announcements')->onDelete('CASCADE'); + $table->foreign(['user_id'])->references(['id'])->on('users')->onDelete('CASCADE'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('announcement_user', function (Blueprint $table) { + $table->dropForeign('announcement_user_announcement_id_foreign'); + $table->dropForeign('announcement_user_user_id_foreign'); + }); + } +} diff --git a/database/migrations/2021_11_03_113305_add_foreign_keys_to_categories_table.php b/database/migrations/2021_11_03_113305_add_foreign_keys_to_categories_table.php new file mode 100644 index 00000000..cfe121b0 --- /dev/null +++ b/database/migrations/2021_11_03_113305_add_foreign_keys_to_categories_table.php @@ -0,0 +1,32 @@ +foreign(['parent_id'])->references(['id'])->on('categories')->onUpdate('CASCADE')->onDelete('SET NULL'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('categories', function (Blueprint $table) { + $table->dropForeign('categories_parent_id_foreign'); + }); + } +} diff --git a/database/migrations/2021_11_03_113305_add_foreign_keys_to_data_rows_table.php b/database/migrations/2021_11_03_113305_add_foreign_keys_to_data_rows_table.php new file mode 100644 index 00000000..84be592f --- /dev/null +++ b/database/migrations/2021_11_03_113305_add_foreign_keys_to_data_rows_table.php @@ -0,0 +1,32 @@ +foreign(['data_type_id'])->references(['id'])->on('data_types')->onUpdate('CASCADE')->onDelete('CASCADE'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('data_rows', function (Blueprint $table) { + $table->dropForeign('data_rows_data_type_id_foreign'); + }); + } +} diff --git a/database/migrations/2021_11_03_113305_add_foreign_keys_to_menu_items_table.php b/database/migrations/2021_11_03_113305_add_foreign_keys_to_menu_items_table.php new file mode 100644 index 00000000..92dd9e8b --- /dev/null +++ b/database/migrations/2021_11_03_113305_add_foreign_keys_to_menu_items_table.php @@ -0,0 +1,32 @@ +foreign(['menu_id'])->references(['id'])->on('menus')->onUpdate('NO ACTION')->onDelete('CASCADE'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('menu_items', function (Blueprint $table) { + $table->dropForeign('menu_items_menu_id_foreign'); + }); + } +} diff --git a/database/migrations/2021_11_03_113305_add_foreign_keys_to_permission_role_table.php b/database/migrations/2021_11_03_113305_add_foreign_keys_to_permission_role_table.php new file mode 100644 index 00000000..4bfa9973 --- /dev/null +++ b/database/migrations/2021_11_03_113305_add_foreign_keys_to_permission_role_table.php @@ -0,0 +1,34 @@ +foreign(['permission_id'])->references(['id'])->on('permissions')->onUpdate('NO ACTION')->onDelete('CASCADE'); + $table->foreign(['role_id'])->references(['id'])->on('roles')->onUpdate('NO ACTION')->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'); + }); + } +} diff --git a/database/migrations/2021_11_03_113305_add_foreign_keys_to_plans_table.php b/database/migrations/2021_11_03_113305_add_foreign_keys_to_plans_table.php new file mode 100644 index 00000000..404c6759 --- /dev/null +++ b/database/migrations/2021_11_03_113305_add_foreign_keys_to_plans_table.php @@ -0,0 +1,32 @@ +foreign(['role_id'])->references(['id'])->on('roles'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('plans', function (Blueprint $table) { + $table->dropForeign('plans_role_id_foreign'); + }); + } +} diff --git a/database/migrations/2021_11_03_113305_add_foreign_keys_to_theme_options_table.php b/database/migrations/2021_11_03_113305_add_foreign_keys_to_theme_options_table.php new file mode 100644 index 00000000..1e775a1a --- /dev/null +++ b/database/migrations/2021_11_03_113305_add_foreign_keys_to_theme_options_table.php @@ -0,0 +1,32 @@ +foreign(['theme_id'])->references(['id'])->on('themes')->onDelete('CASCADE'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('theme_options', function (Blueprint $table) { + $table->dropForeign('theme_options_theme_id_foreign'); + }); + } +} diff --git a/database/migrations/2021_11_03_113305_add_foreign_keys_to_user_roles_table.php b/database/migrations/2021_11_03_113305_add_foreign_keys_to_user_roles_table.php new file mode 100644 index 00000000..7f9456a5 --- /dev/null +++ b/database/migrations/2021_11_03_113305_add_foreign_keys_to_user_roles_table.php @@ -0,0 +1,34 @@ +foreign(['role_id'])->references(['id'])->on('roles')->onUpdate('NO ACTION')->onDelete('CASCADE'); + $table->foreign(['user_id'])->references(['id'])->on('users')->onUpdate('NO ACTION')->onDelete('CASCADE'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('user_roles', function (Blueprint $table) { + $table->dropForeign('user_roles_role_id_foreign'); + $table->dropForeign('user_roles_user_id_foreign'); + }); + } +} diff --git a/database/migrations/2021_11_03_113305_add_foreign_keys_to_users_table.php b/database/migrations/2021_11_03_113305_add_foreign_keys_to_users_table.php new file mode 100644 index 00000000..898644eb --- /dev/null +++ b/database/migrations/2021_11_03_113305_add_foreign_keys_to_users_table.php @@ -0,0 +1,32 @@ +foreign(['role_id'])->references(['id'])->on('roles')->onUpdate('NO ACTION')->onDelete('NO ACTION'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropForeign('users_role_id_foreign'); + }); + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index f0b247fe..0692657c 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -36,5 +36,6 @@ public function run() $this->call(VoyagerThemesTableSeeder::class); $this->call(VoyagerThemeOptionsTableSeeder::class); $this->call(WaveKeyValuesTableSeeder::class); + $this->call(EventsTableSeeder::class); } } diff --git a/database/seeders/EventsTableSeeder.php b/database/seeders/EventsTableSeeder.php new file mode 100644 index 00000000..9db96130 --- /dev/null +++ b/database/seeders/EventsTableSeeder.php @@ -0,0 +1,24 @@ +delete(); + + + + } +} \ No newline at end of file