Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a behavior that copies table declaration elements from a source table to a target table (synced table). All matching changes to the source table will be automatically applied to the synced table when building migrations or creating model files. It is a generalization of functionality from the archiveable behavior, with additional configuration options.
While probably of limited use on its own, it is very useful as a base for other behaviors, like archiveable or versionable, which both use it now as base.
Example configuration
Parameters
These parameters are available:
_synced
null
(resolved to Pascal-case version ofsynced_table
)true
true
)true
/false
true
true
/false
false
index
/unique
/false
false
true
/false
false
null
copyInto
compatible with the synced model.null
true
true
.false
true
true
, the relation will be created, but no constraints on DB level. To create a foreign key on database level, pass in an array defining the key.null
true
/false
false
true
/false
inherit_foreign_key_relations
, but also creates foreign key constraints in the database to the referenced columns of the source table.false
ignore
/inherit
/omit
skipSql="true"
. When set toignore
, the synced table will be created as a regular table. When set toinherit
, the synced table will haveskipSql="true"
too. When set toomit
, the synced table will not be created.omit
When used as base, the inhering behavior can override parameter names (for example, versionable and archiveable rename
table_name
toversion_table
andarchive_table
).