Initial Spark Install
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSubscriptionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('subscriptions', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id');
|
||||
$table->string('name');
|
||||
$table->string('braintree_id');
|
||||
$table->string('braintree_plan');
|
||||
$table->integer('quantity');
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamp('ends_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('team_subscriptions', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('team_id');
|
||||
$table->string('name');
|
||||
$table->string('braintree_id');
|
||||
$table->string('braintree_plan');
|
||||
$table->integer('quantity');
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamp('ends_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('subscriptions');
|
||||
Schema::drop('team_subscriptions');
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTeamsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('teams', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('owner_id')->index();
|
||||
$table->string('name');
|
||||
$table->string('slug')->nullable()->unique();
|
||||
$table->text('photo_url')->nullable();
|
||||
$table->string('braintree_id')->nullable();
|
||||
$table->string('current_billing_plan')->nullable();
|
||||
$table->string('paypal_email')->nullable();
|
||||
$table->string('card_brand')->nullable();
|
||||
$table->string('card_last_four')->nullable();
|
||||
$table->text('extra_billing_information')->nullable();
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('teams');
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('password', 60);
|
||||
$table->rememberToken();
|
||||
$table->text('photo_url')->nullable();
|
||||
$table->tinyInteger('uses_two_factor_auth')->default(0);
|
||||
$table->string('authy_id')->nullable();
|
||||
$table->string('country_code', 10)->nullable();
|
||||
$table->string('phone', 25)->nullable();
|
||||
$table->string('two_factor_reset_code', 100)->nullable();
|
||||
$table->integer('current_team_id')->nullable();
|
||||
$table->string('braintree_id')->nullable();
|
||||
$table->string('current_billing_plan')->nullable();
|
||||
$table->string('paypal_email')->nullable();
|
||||
$table->string('card_brand')->nullable();
|
||||
$table->string('card_last_four')->nullable();
|
||||
$table->text('extra_billing_information')->nullable();
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamp('last_read_announcements_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('users');
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateAnnouncementsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('announcements', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->integer('user_id');
|
||||
$table->text('body');
|
||||
$table->string('action_text')->nullable();
|
||||
$table->text('action_url')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('announcements');
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateApiTokensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('api_tokens', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->integer('user_id');
|
||||
$table->string('name');
|
||||
$table->string('token', 100)->unique();
|
||||
$table->text('metadata');
|
||||
$table->tinyInteger('transient')->default(0);
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'expires_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('api_tokens');
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateInvitationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invitations', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->integer('team_id')->index();
|
||||
$table->integer('user_id')->nullable()->index();
|
||||
$table->string('email');
|
||||
$table->string('token', 40)->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('invitations');
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateInvoicesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invoices', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id')->nullable()->index();
|
||||
$table->integer('team_id')->nullable()->index();
|
||||
$table->string('provider_id');
|
||||
$table->decimal('total')->nullable();
|
||||
$table->decimal('tax')->nullable();
|
||||
$table->string('card_country')->nullable();
|
||||
$table->string('billing_state')->nullable();
|
||||
$table->string('billing_zip')->nullable();
|
||||
$table->string('billing_country')->nullable();
|
||||
$table->string('vat_id', 50)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('invoices');
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateNotificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->integer('user_id');
|
||||
$table->integer('created_by')->nullable();
|
||||
$table->string('icon', 50)->nullable();
|
||||
$table->text('body');
|
||||
$table->string('action_text')->nullable();
|
||||
$table->text('action_url')->nullable();
|
||||
$table->tinyInteger('read')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('notifications');
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token')->index();
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('password_resets');
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePerformanceIndicatorsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('performance_indicators', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->decimal('monthly_recurring_revenue');
|
||||
$table->decimal('yearly_recurring_revenue');
|
||||
$table->decimal('daily_volume');
|
||||
$table->integer('new_users');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('performance_indicators');
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSubscriptionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('subscriptions', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id');
|
||||
$table->string('name');
|
||||
$table->string('stripe_id');
|
||||
$table->string('stripe_plan');
|
||||
$table->integer('quantity');
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamp('ends_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('team_subscriptions', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('team_id');
|
||||
$table->string('name');
|
||||
$table->string('stripe_id');
|
||||
$table->string('stripe_plan');
|
||||
$table->integer('quantity');
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamp('ends_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('subscriptions');
|
||||
Schema::drop('team_subscriptions');
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTeamUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('team_users', function (Blueprint $table) {
|
||||
$table->integer('team_id');
|
||||
$table->integer('user_id');
|
||||
$table->string('role', 20);
|
||||
|
||||
$table->unique(['team_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('team_users');
|
||||
}
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTeamsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('teams', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('owner_id')->index();
|
||||
$table->string('name');
|
||||
$table->string('slug')->nullable()->unique();
|
||||
$table->text('photo_url')->nullable();
|
||||
$table->string('stripe_id')->nullable();
|
||||
$table->string('current_billing_plan')->nullable();
|
||||
$table->string('card_brand')->nullable();
|
||||
$table->string('card_last_four')->nullable();
|
||||
$table->string('card_country')->nullable();
|
||||
$table->string('billing_address')->nullable();
|
||||
$table->string('billing_address_line_2')->nullable();
|
||||
$table->string('billing_city')->nullable();
|
||||
$table->string('billing_state')->nullable();
|
||||
$table->string('billing_zip', 25)->nullable();
|
||||
$table->string('billing_country', 2)->nullable();
|
||||
$table->string('vat_id', 50)->nullable();
|
||||
$table->text('extra_billing_information')->nullable();
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('teams');
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('password', 60);
|
||||
$table->rememberToken();
|
||||
$table->text('photo_url')->nullable();
|
||||
$table->tinyInteger('uses_two_factor_auth')->default(0);
|
||||
$table->string('authy_id')->nullable();
|
||||
$table->string('country_code', 10)->nullable();
|
||||
$table->string('phone', 25)->nullable();
|
||||
$table->string('two_factor_reset_code', 100)->nullable();
|
||||
$table->integer('current_team_id')->nullable();
|
||||
$table->string('stripe_id')->nullable();
|
||||
$table->string('current_billing_plan')->nullable();
|
||||
$table->string('card_brand')->nullable();
|
||||
$table->string('card_last_four')->nullable();
|
||||
$table->string('card_country')->nullable();
|
||||
$table->string('billing_address')->nullable();
|
||||
$table->string('billing_address_line_2')->nullable();
|
||||
$table->string('billing_city')->nullable();
|
||||
$table->string('billing_state')->nullable();
|
||||
$table->string('billing_zip', 25)->nullable();
|
||||
$table->string('billing_country', 2)->nullable();
|
||||
$table->string('vat_id', 50)->nullable();
|
||||
$table->text('extra_billing_information')->nullable();
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamp('last_read_announcements_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('users');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user