Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

-- Create schema, tables, indexes, and constraints used for SNPRC_EHR module here
-- All SQL VIEW definitions should be created in snprc_ehr-create.sql and dropped in snprc_ehr-drop.sql
CREATE SCHEMA snprc_ehr;
GO

Expand Down Expand Up @@ -787,4 +785,51 @@ CREATE TABLE [snprc_ehr].[FeeSchedule](
CONSTRAINT FK_snprc_fee_Schedule_container FOREIGN KEY (Container) REFERENCES core.Containers (EntityId) );

CREATE UNIQUE INDEX idx_snprc_fee_schedule_objectid ON snprc_ehr.feeSchedule (objectid)
CREATE UNIQUE INDEX idx_snprc_fee_schedule_activityId_budgetYear ON snprc_ehr.FeeSchedule (ActivityId, BudgetYear);
CREATE UNIQUE INDEX idx_snprc_fee_schedule_activityId_budgetYear ON snprc_ehr.FeeSchedule (ActivityId, BudgetYear);

/* snprc_ehr-18.10-18.20.sql */

EXEC core.fn_dropifexists 'FeeSchedule','snprc_ehr', 'TABLE';
EXEC core.fn_dropifexists 'FeeScheduleSpeciesLookup','snprc_ehr', 'TABLE';
GO

CREATE TABLE [snprc_ehr].[FeeSchedule](
[RowId] [bigint] IDENTITY(1,1) NOT NULL,
[StartingYear] INTEGER NOT NULL,
[VersionLabel] NVARCHAR(128) NOT NULL,
[ActivityId] INTEGER NOT NULL,
[Species] NVARCHAR(128) NOT NULL,
[Description] NVARCHAR (256) NOT NULL,
[BudgetYear] NVARCHAR (256) NOT NULL,
[Cost] NUMERIC (9,2) NOT NULL,
[FileName] NVARCHAR (256) NOT NULL,
[ObjectId] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWID(),
[Created] [DATETIME] NULL,
[CreatedBy] [dbo].[USERID] NULL,
[Modified] [DATETIME] NULL,
[ModifiedBy] [dbo].[USERID] NULL,
Container entityId NOT NULL


CONSTRAINT PK_snprc_fee_schedule PRIMARY KEY ([RowId])
CONSTRAINT FK_snprc_fee_Schedule_container FOREIGN KEY (Container) REFERENCES core.Containers (EntityId) );

CREATE UNIQUE INDEX idx_snprc_fee_schedule_objectid ON snprc_ehr.feeSchedule (objectid)
CREATE UNIQUE INDEX idx_snprc_fee_schedule_activityId_budgetYear ON snprc_ehr.FeeSchedule (StartingYear, VersionLabel, ActivityId, BudgetYear);
GO

CREATE TABLE [snprc_ehr].[FeeScheduleSpeciesLookup] (
[FsSpecies] [VARCHAR](128) NOT NULL,
[SpeciesCode] [VARCHAR](2) NOT NULL,
[ObjectId] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWID(),
[Created] [DATETIME] NULL,
[CreatedBy] [dbo].[USERID] NULL,
[Modified] [DATETIME] NULL,
[ModifiedBy] [dbo].[USERID] NULL,
[Container] [dbo].[ENTITYID] NOT NULL

CONSTRAINT [PK_FeeScheduleSpeciesLookup] PRIMARY KEY CLUSTERED ([FsSpecies], [SpeciesCode])
CONSTRAINT [FK_FeeScheduleSpeciesLookup_container] FOREIGN KEY (Container) REFERENCES core.Containers (EntityId) );
GO

ALTER TABLE snprc_ehr.package ADD pkgType NVARCHAR(1) not null default 'U';

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

-- Create schema, tables, indexes, and constraints used for snprc_r24 module here
-- All SQL VIEW definitions should be created in snprc_r24-create.sql and dropped in snprc_r24-drop.sql
CREATE SCHEMA snprc_r24;
GO

Expand Down Expand Up @@ -124,4 +122,30 @@ CREATE UNIQUE NONCLUSTERED INDEX [idx_snprc_r24_lookups_setname] ON [snprc_r24].
GO

ALTER TABLE [snprc_r24].[Lookups] ADD DEFAULT (NEWID()) FOR [ObjectId]
GO

/* snprc_r24-18.10-18.20.sql */

ALTER TABLE snprc_r24.SampleInventory ADD SampleWeight NUMERIC(7,2) NULL;
ALTER TABLE snprc_r24.SampleInventory ADD SampleAmount NUMERIC(7,2) NULL;

CREATE TABLE [snprc_r24].[RowsToDelete](
[ObjectId] [dbo].[EntityId] NOT NULL,
[Modified] [DATETIME] NOT NULL
CONSTRAINT [pk_snprc_r24_RowsToDelete] PRIMARY KEY ( [ObjectId] ASC) );

GO

CREATE TABLE [snprc_r24].[WeightStaging] (
[AnimalId] [NVARCHAR](32) NOT NULL,
[Date] [DATETIME] NOT NULL,
[Weight] [NUMERIC](7,4) NOT NULL,
[ObjectId] [dbo].EntityId NOT NULL,
[Created] [DATETIME] NULL,
[CreatedBy] [dbo].[USERID] NULL,
[Modified] [DATETIME] NULL,
[ModifiedBy] [dbo].[USERID] NULL

CONSTRAINT [pk_snprc_r24_weight_staging] PRIMARY KEY ( [ObjectId] ASC) );

GO

This file was deleted.