Last active
December 17, 2015 17:29
-
-
Save designermonkey/5646377 to your computer and use it in GitHub Desktop.
Symphony CMS table schemas in Laravel format. I don't expect these all to be used, but they are here for a starting point.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sections Table | |
* | |
* Removed a default for 'name' as it will always be set | |
*/ | |
Schema::create('sections', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->string('name', 255); | |
$table->string('handle', 255); | |
$table->integer('sortorder')->unsigned()->default('1'); | |
$table->enum('hidden', array('yes', 'no'))->default('no'); | |
$table->string('navigation_group', 255)->default('Content'); | |
$table->primary('id'); | |
$table->unique('handle'); | |
}); | |
/** | |
* Fields Table | |
* | |
* Changed label to name | |
* Changed element_name to handle | |
* Changed location to three columns (We may move to this in layout) | |
*/ | |
Schema::create('fields', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('section_id')->unsigned()->default('0'); | |
$table->string('name', 255); | |
$table->string('handle', 50); | |
$table->string('type', 100); | |
$table->enum('required', array('yes', 'no'))->default('yes'); | |
$table->integer('sortorder')->unsigned()->default('1'); | |
$table->enum('location', array('left', 'middle', 'right'))->default('left'); | |
$table->enum('show_column', array('yes', 'no'))->default('no'); | |
$table->primary('id'); | |
$table->index(array('handle', 'type', 'section_id')); | |
}); | |
/** | |
* Entries Table | |
* | |
* Removed UTC date columns as all dates should be stored as UTC | |
* Changed remaining date columns to Laravel style timestamps | |
*/ | |
Schema::create('entries', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('section_id')->unsigned(); | |
$table->integer('author_id')->unsigned(); | |
$table->timestamps(); | |
$table->primary('id'); | |
$table->index('section_id'); | |
$table->index('author_id'); | |
}); | |
/** | |
* Associations Table | |
* | |
* Renamed to just `associations` from `sections_associations` | |
* Removed section references as they are implied by the field IDs | |
* Removed some 'default null' statements for some columns as they will always contain values | |
*/ | |
Schema::create('associations', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('parent_field_id')->unsigned(); | |
$table->integer('child_field_id')->unsigned(); | |
$table->enum('hide_association', array('yes', 'no'))->default('no'); | |
$table->primary('id'); | |
$table->unique(array('parent_field_id', 'child_field_id')); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Checkbox Field Schema | |
* | |
* Changed some column names | |
*/ | |
Schema::create('fields_schema_checkbox', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->enum('default_state', array('on', 'off'))->default('on'); | |
$table->string('description', 255)->nullable(); | |
$table->primary('id'); | |
$table->unique('field_id'); | |
}); | |
/** | |
* Checkbox Field Data | |
* | |
* Only a single entry can exist for the `entry_id` | |
*/ | |
Schema::create('filds_data_checkbox', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->integer('entry_id')->unsigned(); | |
$table->enum('value', array('yes', 'no')); // The default needs to be set by the schema for each field | |
$table->primary('id'); | |
$table->index('field_id'); | |
$table->unique('entry_id'); | |
$table->index('value'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Date Field Schema | |
* | |
* Changed some column names | |
*/ | |
Schema::create('fields_schema_date', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->enum('pre_populate', array('yes', 'no'))->default('no'); | |
$table->primary('id'); | |
$table->unique('field_id'); | |
}); | |
/** | |
* Date Field Data | |
* | |
* Only a single entry can exist for the `entry_id` | |
*/ | |
Schema::create('filds_data_date', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->integer('entry_id')->unsigned(); | |
$table->string('value', 100); | |
$table->datetime('date'); | |
$table->primary('id'); | |
$table->index('field_id'); | |
$table->unique('entry_id'); | |
$table->index('value'); | |
$table->index('date'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Taglist Field Schema | |
* | |
* Changed some column names | |
*/ | |
Schema::create('fields_schema_number', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->primary('id'); | |
$table->unique('field_id'); | |
}); | |
/** | |
* Taglist Field Data | |
* | |
* Only a single entry can exist for the `entry_id` | |
*/ | |
Schema::create('filds_data_number', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->integer('entry_id')->unsigned(); | |
$table->addColumn('double', 'value', array()); // A special case as Laravel doesn't allow us to define double | |
$table->primary('id'); | |
$table->index('field_id'); | |
$table->unique('entry_id'); | |
$table->index('value'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Selectbox Link Field Schema | |
* | |
* Changed some column names | |
*/ | |
Schema::create('fields_schema_selectbox_link', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->enum('allow_multiple', array('yes', 'no'))->default('no'); | |
$table->enum('show_association', array('yes', 'no'))->default('yes'); | |
$table->enum('hide_prepopulated', array('yes', 'no'))->default('no'); | |
$table->integer('related_field_id')->unsigned(); | |
$table->integer('limit')->unsigned()->default(20); | |
$table->primary('id'); | |
$table->unique('field_id'); | |
}); | |
/** | |
* Laravel Schema: Select Field Data | |
* | |
* Multiple entries can exist for the same `entry_id` | |
*/ | |
Schema::create('filds_data_selectbox_link', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->integer('entry_id')->unsigned(); | |
$table->integer('related_entry_id')->nullable(); | |
$table->primary('id'); | |
$table->index('field_id'); | |
$table->index('entry_id'); | |
$table->index('related_entry_id'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Selectbox Field Schema | |
* | |
* Changed some column names | |
*/ | |
Schema::create('fields_schema_select', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->enum('allow_multiple', array('yes', 'no'))->default('no'); | |
$table->enum('show_association', array('yes', 'no'))->default('yes'); | |
$table->enum('sort_options', array('yes', 'no'))->default('no'); | |
$table->text('static_options'); | |
$table->integer('dynamic_options')->unsigned()->nullable(); | |
$table->primary('id'); | |
$table->unique('field_id'); | |
}); | |
/** | |
* Selectbox Field Data | |
* | |
* Multiple entries can exist for the same `entry_id` | |
*/ | |
Schema::create('filds_data_select', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->integer('entry_id')->unsigned(); | |
$table->string('handle', 255); | |
$table->string('value', 255); | |
$table->primary('id'); | |
$table->index('field_id'); | |
$table->index('entry_id'); | |
$table->index('handle'); | |
$table->index('value'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Taglist Field Schema | |
* | |
* Changed some column names | |
*/ | |
Schema::create('fields_schema_taglist', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->string('validator', 255)->nullable(); | |
$table->string('pre_populate_source', 15); | |
$table->primary('id'); | |
$table->unique('field_id'); | |
$table->index('pre_populate_source'); | |
}); | |
/** | |
* Taglist Field Data | |
*/ | |
Schema::create('filds_data_taglist', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->integer('entry_id')->unsigned(); | |
$table->text('handle'); | |
$table->text('value'); | |
$table->primary('id'); | |
$table->index('field_id'); | |
$table->index('entry_id'); | |
$table->index('handle'); | |
$table->index('value'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Text Field Schema | |
* | |
* Replaces: Text Input, Textarea, and Text Box (based on Text Box) | |
* | |
* Changed some column names | |
*/ | |
Schema::create('fields_schema_text', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->integer('column_length')->unsigned(); | |
$table->enum('size', array('single', 'small', 'medium', 'large', 'huge'))->default('single'); | |
$table->string('formatter', 255)->nullable(); | |
$table->string('validator', 255)->nullable(); | |
$table->integer('max_length')->default(0); | |
$table->enum('cdata_wrap', array('yes', 'no'))->default('no'); | |
$table->enum('create_handle', array('yes', 'no'))->default('yes'); | |
$table->primary('id'); | |
$table->unique('field_id'); | |
}); | |
/** | |
* Text Field Data | |
*/ | |
Schema::create('filds_data_text', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->integer('entry_id')->unsigned(); | |
$table->text('handle'); | |
$table->text('value'); | |
$table->text('value_formatted'); | |
$table->primary('id'); | |
$table->index('field_id'); | |
$table->index('entry_id'); | |
$table->index('handle'); | |
$table->index('value'); | |
$table->index('value_formatted'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Upload Field Schema | |
* | |
* Changed some column names | |
*/ | |
Schema::create('fields_schema_upload', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->string('destination', 255); | |
$table->string('validator', 255)->nullable(); | |
$table->primary('id'); | |
$table->unique('field_id'); | |
}); | |
/** | |
* Upload Field Data | |
* | |
* Only a single entry can exist for the `entry_id` | |
*/ | |
Schema::create('filds_data_upload', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('field_id')->unsigned(); | |
$table->integer('entry_id')->unsigned(); | |
$table->string('file', 255); | |
$table->integer('size')->unsigned(); | |
$table->string('mimetype', 100)->nullable(); | |
$table->string('meta', 255)->nullable(); | |
$table->primary('id'); | |
$table->index('field_id'); | |
$table->unique('entry_id'); | |
$table->index('file'); | |
$table->index('mimetype'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Pages Table | |
* | |
* Removed some 'default null' statements for some columns as they will always contain values | |
*/ | |
Schema::create('pages', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('parent')->unsigned()->nullable(); | |
$table->string('title', 255); | |
$table->string('handle', 255); | |
$table->string('path', 255)->nullable(); | |
$table->string('params', 255)->nullable(); | |
$table->text('data_sources')->nullable(); | |
$table->text('events')->nullable(); | |
$table->integer('sortorder')->unsigned()->default('1'); | |
$table->primary('id'); | |
$table->index('parent'); | |
}); | |
/** | |
* Pages Types Table | |
*/ | |
Schema::create('pages_types', function($table) | |
{ | |
$table->increments('id')->unsigned(); | |
$table->integer('page_id')->unsigned(); | |
$table->string('type', 50); | |
$table->primary('id'); | |
$table->unique(array('page_id', 'type')); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Cache Table | |
* | |
* Complete change to Laravel style table | |
*/ | |
Schema::create('cache', function($table) | |
{ | |
$table->string('key'); | |
$table->text('value'); | |
$table->timestamp('expiration'); | |
$table->unique('key'); | |
$table->index('expiry'); | |
$table->index('hash'); | |
}); | |
/** | |
* Sessions table | |
* | |
* Complete change to Laravel style table | |
*/ | |
Schema::create('sessions', function($table) | |
{ | |
$table->string('id'); | |
$table->text('payload'); | |
$table->integer('last_activity'); | |
$table->unique('id'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment