generated from DEFRA/ffc-template-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e760a8
commit d4f0046
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = (sequelize, DataTypes) => { | ||
const sourceSystem = sequelize.define('sourceSystem', { | ||
sourceSystemId: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, | ||
schemeId: DataTypes.INTEGER, | ||
name: DataTypes.STRING | ||
}, | ||
{ | ||
tableName: 'sourceSystems', | ||
freezeTableName: true, | ||
timestamps: false | ||
}) | ||
sourceSystem.associate = function (models) { | ||
sourceSystem.belongsTo(models.scheme, { | ||
foreignKey: 'schemeId', | ||
as: 'scheme' | ||
}) | ||
} | ||
return sourceSystem | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.9.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd"> | ||
<changeSet author="John Watson" id="37"> | ||
<createTable tableName="sourceSystems"> | ||
<column autoIncrement="true" name="sourceSystemId" type="INTEGER"> | ||
<constraints nullable="false" primaryKey="true" primaryKeyName="sourceSystemId_pkey" /> | ||
</column> | ||
<column name="schemeId" type="INTEGER" /> | ||
<column name="name" type="VARCHAR(50)" /> | ||
</createTable> | ||
<insert tableName="sourceSystems"> | ||
<column name="sourceSystemId" value="1" /> | ||
<column name="schemeId" value="1" /> | ||
<column name="name" value="SFIP" /> | ||
</insert> | ||
<insert tableName="sourceSystems"> | ||
<column name="sourceSystemId" value="2" /> | ||
<column name="schemeId" value="1" /> | ||
<column name="name" value="ffc-sfi-agreeement-calculator" /> | ||
</insert> | ||
</changeSet> | ||
<changeSet author="John Watson" id="38"> | ||
<addForeignKeyConstraint baseColumnNames="schemeId" baseTableName="sourceSystems" constraintName="fk_sourceSystems_schemeCodeId" referencedColumnNames="schemeId" referencedTableName="schemes" /> | ||
</changeSet> | ||
</databaseChangeLog> |
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
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