14 use Illuminate\Database\Migrations\Migration;
15 use Illuminate\Database\Schema\Builder;
16 use Illuminate\Database\Schema\Blueprint;
17 use Illuminate\Database\Capsule\Manager as Capsule;
24 public function up() {
26 Capsule::schema()->create(
'library_files',
function (Blueprint $table) {
27 $table->bigInteger(
'file_id')->autoIncrement();
28 $table->bigInteger(
'context_id');
29 $table->string(
'file_name', 255);
30 $table->string(
'original_file_name', 255);
31 $table->string(
'file_type', 255);
32 $table->bigInteger(
'file_size');
33 $table->smallInteger(
'type');
34 $table->datetime(
'date_uploaded');
35 $table->datetime(
'date_modified');
36 $table->bigInteger(
'submission_id');
37 $table->smallInteger(
'public_access')->
default(0)->nullable();
38 $table->index([
'context_id'],
'library_files_context_id');
39 $table->index([
'submission_id'],
'library_files_submission_id');
43 Capsule::schema()->create(
'library_file_settings',
function (Blueprint $table) {
44 $table->bigInteger(
'file_id');
45 $table->string(
'locale', 14)->
default(
'');
46 $table->string(
'setting_name', 255);
47 $table->text(
'setting_value')->nullable();
48 $table->string(
'setting_type', 6)->comment(
'(bool|int|float|string|object|date)');
49 $table->index([
'file_id'],
'library_file_settings_id');
50 $table->unique([
'file_id',
'locale',
'setting_name'],
'library_file_settings_pkey');
59 Capsule::schema()->drop(
'library_file_settings');
60 Capsule::schema()->drop(
'library_files');