Schema::create('cryptocurrencies', function (Blueprint $table) {
$table->id('id');
$table->string('name');
$table->string('symbol')->unique();
$table->string('slug');
$table->longtext('description');
});
这是我的第二个模式:
Schema::create('cryptocurrencies_quotes', function (Blueprint $table) {
$table->id('id');
$table->string('name');
$table->string('symbol');
$table->string('slug');
$table->integer('cryptocurrency_id');
$table->bigInteger('circulating_supply');
$table->bigInteger('total_supply');
$table->double('price');
$table->double('volume_24h');
$table->timestamps();
});
Schema::table('cryptocurrencies_quotes', function (Blueprint $table) {
$table->foreign('cryptocurrency_id')->references('id')->on('cryptocurrencies')->onUpdate('cascade')->onDelete('cascade');
});