From 54101f9b14890d2675c7a3e251ca4e021d2bb987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uro=C5=A1=20Verhovnik?= <56766664+VerhovnikU@users.noreply.github.com> Date: Fri, 3 Feb 2023 09:26:08 +0100 Subject: [PATCH 1/8] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 685e918..cc58d41 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ To install, first fork/clone repository and then follow these steps: - Copy contents of FillSampleData.sql file in **BeGenericDatabase** database project and paste and run it on the selected database - Enjoy the very easily made Be-Generic-based backend 😉 + Docker-compose: + - Change uncomment connectionString line for docker config and comment the previous one in appsettings.json file + - Change the password in BeGeneric/sql/Dockerfile and connectionString in appsettings.json if you like + - run docker-compose up in directory where docker-compose.yml is located + - Enjoy 😉 + > **Warning** > > Build the solution **TWICE**. All the Models, DTO Models and Entity Framework context get created automatically, and Visual Studio will usually fail the first build. Usually pre-build scripts don't take long, but if they do and build always fails, check the connection string in the appsettings.json and appsettings.development.json From ee6704117235daba1e15d51cac7a080cc5efb2e4 Mon Sep 17 00:00:00 2001 From: "Uros Verhovnik (LJ)" Date: Fri, 3 Feb 2023 09:27:36 +0100 Subject: [PATCH 2/8] added Docker-compose support --- .dockerignore | 25 + BeGeneric/Dockerfile | 19 + BeGeneric/appsettings.json | 4 +- BeGeneric/sql/Dockerfile | 20 + BeGeneric/sql/entrypoint.sh | 3 + BeGeneric/sql/init.sql | 910 ++++++++++++++++++++++++++++++++++++ docker-compose.yml | 25 + 7 files changed, 1005 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 BeGeneric/Dockerfile create mode 100644 BeGeneric/sql/Dockerfile create mode 100644 BeGeneric/sql/entrypoint.sh create mode 100644 BeGeneric/sql/init.sql create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/BeGeneric/Dockerfile b/BeGeneric/Dockerfile new file mode 100644 index 0000000..53d36e4 --- /dev/null +++ b/BeGeneric/Dockerfile @@ -0,0 +1,19 @@ +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["BeGeneric/BeGeneric.csproj", "BeGeneric/"] +RUN dotnet restore "BeGeneric/BeGeneric.csproj" +COPY . . +WORKDIR "/src/BeGeneric" +RUN dotnet build "BeGeneric.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "BeGeneric.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "BeGeneric.dll"] \ No newline at end of file diff --git a/BeGeneric/appsettings.json b/BeGeneric/appsettings.json index 9a2b06c..454b0ca 100644 --- a/BeGeneric/appsettings.json +++ b/BeGeneric/appsettings.json @@ -7,7 +7,9 @@ } }, "ConnectionStrings": { - "connectionString": "Server=localhost;Database=BeGenericSample;Integrated Security=SSPI" + //"connectionString": "Server=localhost;Database=BeGenericSample;Integrated Security=SSPI", + //docker config + "connectionString": "Server=host.docker.internal,1433;Database=BeGenericSample;User Id=sa;Password=Password123;" }, "Jwt": { "Key": "ThisismySecretKey", diff --git a/BeGeneric/sql/Dockerfile b/BeGeneric/sql/Dockerfile new file mode 100644 index 0000000..d437ecc --- /dev/null +++ b/BeGeneric/sql/Dockerfile @@ -0,0 +1,20 @@ +# Use the official Microsoft SQL Server image as the base image +FROM mcr.microsoft.com/mssql/server:latest + +# Set the working directory in the container to /app +WORKDIR /app + +# Copy the initialization script to the /app directory in the container +COPY ./BeGeneric/sql /app +RUN ls + +# Set the environment variable for the SA password +ENV ACCEPT_EULA=Y \ + SA_PASSWORD=Password123 + + +EXPOSE 1433 + +# Run the initialization script when the container starts +CMD /bin/bash entrypoint.sh & /opt/mssql/bin/sqlservr + diff --git a/BeGeneric/sql/entrypoint.sh b/BeGeneric/sql/entrypoint.sh new file mode 100644 index 0000000..53f08f2 --- /dev/null +++ b/BeGeneric/sql/entrypoint.sh @@ -0,0 +1,3 @@ +sleep 20 +echo "wait 20 seconds" +/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -i init.sql diff --git a/BeGeneric/sql/init.sql b/BeGeneric/sql/init.sql new file mode 100644 index 0000000..c20474f --- /dev/null +++ b/BeGeneric/sql/init.sql @@ -0,0 +1,910 @@ +/* +Deployment script for TestSample + +This code was generated by a tool. +Changes to this file may cause incorrect behavior and will be lost if +the code is regenerated. +*/ + +GO +SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON; + +SET NUMERIC_ROUNDABORT OFF; + +GO +USE [master]; + +GO +PRINT N'Creating database SampleDb...' +GO +CREATE DATABASE [BeGenericSample] + +GO +USE [BeGenericSample]; + + +GO +PRINT N'Creating Schema [gba]...'; + + +GO +CREATE SCHEMA [gba] + AUTHORIZATION [dbo]; + + +GO +PRINT N'Creating Table [gba].[Endpoint]...'; + + +GO +CREATE TABLE [gba].[Endpoint] ( + [EndpointId] UNIQUEIDENTIFIER NOT NULL, + [EndpointPath] NVARCHAR (500) NOT NULL, + [StartingEntityId] UNIQUEIDENTIFIER NOT NULL, + [RoleId] UNIQUEIDENTIFIER NULL, + [Filter] NVARCHAR (MAX) NULL, + [DefaultPageNumber] INT NULL, + [DefaultPageSize] INT NULL, + [DefaultSortOrderProperty] NVARCHAR (100) NULL, + [DefaultSortOrder] NVARCHAR (10) NULL, + CONSTRAINT [PK_Endpoint] PRIMARY KEY CLUSTERED ([EndpointId] ASC) +); + + +GO +PRINT N'Creating Table [gba].[EndpointProperty]...'; + + +GO +CREATE TABLE [gba].[EndpointProperty] ( + [EndpointPropertyId] UNIQUEIDENTIFIER NOT NULL, + [EndpointId] UNIQUEIDENTIFIER NOT NULL, + [PropertyName] NVARCHAR (500) NOT NULL, + [PropertyPath] NVARCHAR (2000) NULL, + CONSTRAINT [PK_EndpointProperty] PRIMARY KEY CLUSTERED ([EndpointPropertyId] ASC) +); + + +GO +PRINT N'Creating Table [gba].[ColumnMetadata]...'; + + +GO +CREATE TABLE [gba].[ColumnMetadata] ( + [TableName] NVARCHAR (450) NOT NULL, + [ColumnName] NVARCHAR (450) NOT NULL, + [AllowedValues] NVARCHAR (MAX) NULL, + [Regex] NVARCHAR (MAX) NULL, + CONSTRAINT [PK_ColumnMetadata] PRIMARY KEY CLUSTERED ([TableName] ASC, [ColumnName] ASC) +); + + +GO +PRINT N'Creating Table [gba].[Entities]...'; + + +GO +CREATE TABLE [gba].[Entities] ( + [EntityId] UNIQUEIDENTIFIER NOT NULL, + [ControllerName] NVARCHAR (MAX) NULL, + [TableName] NVARCHAR (MAX) NULL, + [ObjectName] NVARCHAR (MAX) NULL, + [SoftDeleteColumn] NVARCHAR (MAX) NULL, + CONSTRAINT [PK_Entities] PRIMARY KEY CLUSTERED ([EntityId] ASC) +); + + +GO +PRINT N'Creating Table [gba].[EntityRelation]...'; + + +GO +CREATE TABLE [gba].[EntityRelation] ( + [EntityRelationId] UNIQUEIDENTIFIER NOT NULL, + [CrossTableName] NVARCHAR (MAX) NOT NULL, + [Entity1Id] UNIQUEIDENTIFIER NOT NULL, + [Entity1ReferencingColumnName] NVARCHAR (MAX) NOT NULL, + [Entity1PropertyName] NVARCHAR (MAX) NULL, + [Entity2Id] UNIQUEIDENTIFIER NOT NULL, + [Entity2ReferencingColumnName] NVARCHAR (MAX) NOT NULL, + [Entity2PropertyName] NVARCHAR (MAX) NULL, + [ValidFromColumnName] NVARCHAR (MAX) NULL, + [ValidToColumnName] NVARCHAR (MAX) NULL, + [ActiveColumnName] NVARCHAR (MAX) NULL, + [ShowInEntity1Min] BIT NOT NULL, + [ShowInEntity2Min] BIT NOT NULL, + CONSTRAINT [PK_EntityRelation] PRIMARY KEY CLUSTERED ([EntityRelationId] ASC) +); + + +GO +PRINT N'Creating Table [gba].[EntityRole]...'; + + +GO +CREATE TABLE [gba].[EntityRole] ( + [EntitiesEntityId] UNIQUEIDENTIFIER NOT NULL, + [RolesId] UNIQUEIDENTIFIER NOT NULL, + [GetOne] BIT NOT NULL, + [GetAll] BIT NOT NULL, + [Post] BIT NOT NULL, + [Put] BIT NOT NULL, + [Delete] BIT NOT NULL, + [ViewFilter] NVARCHAR (MAX) NULL, + [EditFilter] NVARCHAR (MAX) NULL, + CONSTRAINT [PK_EntityRole] PRIMARY KEY CLUSTERED ([EntitiesEntityId] ASC, [RolesId] ASC) +); + + +GO +PRINT N'Creating Table [gba].[Properties]...'; + + +GO +CREATE TABLE [gba].[Properties] ( + [PropertyId] UNIQUEIDENTIFIER NOT NULL, + [PropertyName] NVARCHAR (MAX) NULL, + [EntityId] UNIQUEIDENTIFIER NOT NULL, + [ReferencingEntityId] UNIQUEIDENTIFIER NULL, + [IsKey] BIT NOT NULL, + [UseInBaseModel] BIT NOT NULL, + [RelatedModelPropertyName] NVARCHAR (500) NULL, + [DisplayInRelatedEntityBaseModel] BIT NOT NULL, + [ModelPropertyName] NVARCHAR (MAX) NULL, + [IsReadOnly] BIT NOT NULL, + CONSTRAINT [PK_Properties] PRIMARY KEY CLUSTERED ([PropertyId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[AbsenceCategory]...'; + + +GO +CREATE TABLE [dbo].[AbsenceCategory] ( + [AbsenceCategoryId] UNIQUEIDENTIFIER NOT NULL, + [Name] NVARCHAR (200) NOT NULL, + [Description] NVARCHAR (MAX) NULL, + [SalaryFactor] DECIMAL (5, 2) NOT NULL, + CONSTRAINT [PK_AbsenceCategory] PRIMARY KEY CLUSTERED ([AbsenceCategoryId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[Accounts]...'; + + +GO +CREATE TABLE [dbo].[Accounts] ( + [Username] NVARCHAR (100) NOT NULL, + [EmailAddress] NVARCHAR (500) NULL, + [PasswordHash] VARBINARY (500) NULL, + [RoleId] UNIQUEIDENTIFIER NOT NULL, + CONSTRAINT [PK_Accounts] PRIMARY KEY CLUSTERED ([Username] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[Department]...'; + + +GO +CREATE TABLE [dbo].[Department] ( + [DepartmentId] UNIQUEIDENTIFIER NOT NULL, + [Name] NVARCHAR (500) NOT NULL, + [Description] NVARCHAR (MAX) NULL, + CONSTRAINT [PK_Department] PRIMARY KEY CLUSTERED ([DepartmentId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[Document]...'; + + +GO +CREATE TABLE [dbo].[Document] ( + [DocumentId] UNIQUEIDENTIFIER NOT NULL, + [FilePath] NVARCHAR (2000) NOT NULL, + [UploadedDate] DATETIME2 (7) NOT NULL, + CONSTRAINT [PK_Document] PRIMARY KEY CLUSTERED ([DocumentId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[Employee]...'; + + +GO +CREATE TABLE [dbo].[Employee] ( + [EmployeeId] UNIQUEIDENTIFIER NOT NULL, + [FirstName] NVARCHAR (500) NOT NULL, + [LastName] NVARCHAR (500) NOT NULL, + [MiddleName] NVARCHAR (500) NULL, + [EmployedFrom] DATETIME2 (7) NOT NULL, + [EmployedTo] DATETIME2 (7) NULL, + [SuperiorId] UNIQUEIDENTIFIER NULL, + [DepartmentId] UNIQUEIDENTIFIER NOT NULL, + [JobId] UNIQUEIDENTIFIER NOT NULL, + [VacationDays] TINYINT NULL, + [EmployeeType] VARCHAR (50) NOT NULL, + [IsActive] BIT NOT NULL, + CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED ([EmployeeId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[EmployeeAbsence]...'; + + +GO +CREATE TABLE [dbo].[EmployeeAbsence] ( + [EmployeeAbsenceId] UNIQUEIDENTIFIER NOT NULL, + [EmployeeId] UNIQUEIDENTIFIER NOT NULL, + [DateFrom] DATETIME2 (7) NOT NULL, + [DateTo] DATETIME2 (7) NOT NULL, + [AbsenceStatus] VARCHAR (50) NULL, + [AbsenceCategoryId] UNIQUEIDENTIFIER NOT NULL, + CONSTRAINT [PK_EmployeeAbsence] PRIMARY KEY CLUSTERED ([EmployeeAbsenceId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[EmployeeAbsenceDocument]...'; + + +GO +CREATE TABLE [dbo].[EmployeeAbsenceDocument] ( + [EmployeeAbsenceDocumentId] UNIQUEIDENTIFIER NOT NULL, + [FilePath] NVARCHAR (2000) NOT NULL, + [UploadedDate] DATETIME2 (7) NOT NULL, + [EmployeeAbsenceId] UNIQUEIDENTIFIER NOT NULL, + CONSTRAINT [PK_EmployeeAbsenceDocument] PRIMARY KEY CLUSTERED ([EmployeeAbsenceDocumentId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[EmployeeDocument]...'; + + +GO +CREATE TABLE [dbo].[EmployeeDocument] ( + [EmployeeDocumentId] UNIQUEIDENTIFIER NOT NULL, + [FilePath] NVARCHAR (2000) NOT NULL, + [UploadedDate] DATETIME2 (7) NOT NULL, + CONSTRAINT [PK_EmployeeDocument] PRIMARY KEY CLUSTERED ([EmployeeDocumentId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[EmployeeJobHistory]...'; + + +GO +CREATE TABLE [dbo].[EmployeeJobHistory] ( + [EmployeeJobHistoryId] UNIQUEIDENTIFIER NOT NULL, + [EmployeeId] UNIQUEIDENTIFIER NOT NULL, + [JobId] UNIQUEIDENTIFIER NOT NULL, + [StartDate] DATETIME2 (7) NOT NULL, + [EndDate] DATETIME2 (7) NOT NULL, + CONSTRAINT [PK_EmployeeJobHistory] PRIMARY KEY CLUSTERED ([EmployeeJobHistoryId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[EmployeeSalary]...'; + + +GO +CREATE TABLE [dbo].[EmployeeSalary] ( + [EmployeeSalaryId] UNIQUEIDENTIFIER NOT NULL, + [EmployeeId] UNIQUEIDENTIFIER NOT NULL, + [Salary] DECIMAL (18, 2) NOT NULL, + [ValidFrom] DATETIME2 (7) NOT NULL, + [ValidTo] DATETIME2 (7) NULL, + [SalaryType] VARCHAR (50) NOT NULL, + CONSTRAINT [PK_EmployeeSalary] PRIMARY KEY CLUSTERED ([EmployeeSalaryId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[Job]...'; + + +GO +CREATE TABLE [dbo].[Job] ( + [JobId] UNIQUEIDENTIFIER NOT NULL, + [Name] NVARCHAR (500) NOT NULL, + [Description] NVARCHAR (MAX) NULL, + CONSTRAINT [PK_Job] PRIMARY KEY CLUSTERED ([JobId] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[ResetPassword]...'; + + +GO +CREATE TABLE [dbo].[ResetPassword] ( + [Id] UNIQUEIDENTIFIER NOT NULL, + [Username] NVARCHAR (100) NOT NULL, + [Expires] DATETIME2 (7) NOT NULL, + [CodeHash] VARBINARY (500) NOT NULL, + CONSTRAINT [PK_ResetPassword] PRIMARY KEY CLUSTERED ([Id] ASC) +); + + +GO +PRINT N'Creating Table [dbo].[Roles]...'; + + +GO +CREATE TABLE [dbo].[Roles] ( + [Id] UNIQUEIDENTIFIER NOT NULL, + [RoleName] NVARCHAR (100) NULL, + [RoleDescription] NVARCHAR (MAX) NULL, + CONSTRAINT [PK_Roles] PRIMARY KEY CLUSTERED ([Id] ASC) +); + + +GO +PRINT N'Creating Default Constraint [gba].[DF_Endpoint_EndpointId]...'; + + +GO +ALTER TABLE [gba].[Endpoint] + ADD CONSTRAINT [DF_Endpoint_EndpointId] DEFAULT (newid()) FOR [EndpointId]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EndpointProperty_EndpointPropertyId]...'; + + +GO +ALTER TABLE [gba].[EndpointProperty] + ADD CONSTRAINT [DF_EndpointProperty_EndpointPropertyId] DEFAULT (newid()) FOR [EndpointPropertyId]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_Entities_EntityId]...'; + + +GO +ALTER TABLE [gba].[Entities] + ADD CONSTRAINT [DF_Entities_EntityId] DEFAULT (newid()) FOR [EntityId]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EntityRelation_EntityRelationId]...'; + + +GO +ALTER TABLE [gba].[EntityRelation] + ADD CONSTRAINT [DF_EntityRelation_EntityRelationId] DEFAULT (newid()) FOR [EntityRelationId]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EntityRelation_ShowInEntity1Min]...'; + + +GO +ALTER TABLE [gba].[EntityRelation] + ADD CONSTRAINT [DF_EntityRelation_ShowInEntity1Min] DEFAULT ((0)) FOR [ShowInEntity1Min]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EntityRelation_ShowInEntity2Min]...'; + + +GO +ALTER TABLE [gba].[EntityRelation] + ADD CONSTRAINT [DF_EntityRelation_ShowInEntity2Min] DEFAULT ((0)) FOR [ShowInEntity2Min]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EntityRole_EntitiesEntityId]...'; + + +GO +ALTER TABLE [gba].[EntityRole] + ADD CONSTRAINT [DF_EntityRole_EntitiesEntityId] DEFAULT (newid()) FOR [EntitiesEntityId]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EntityRole_GetOne]...'; + + +GO +ALTER TABLE [gba].[EntityRole] + ADD CONSTRAINT [DF_EntityRole_GetOne] DEFAULT ((1)) FOR [GetOne]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EntityRole_GetAll]...'; + + +GO +ALTER TABLE [gba].[EntityRole] + ADD CONSTRAINT [DF_EntityRole_GetAll] DEFAULT ((1)) FOR [GetAll]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EntityRole_Post]...'; + + +GO +ALTER TABLE [gba].[EntityRole] + ADD CONSTRAINT [DF_EntityRole_Post] DEFAULT ((1)) FOR [Post]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EntityRole_Put]...'; + + +GO +ALTER TABLE [gba].[EntityRole] + ADD CONSTRAINT [DF_EntityRole_Put] DEFAULT ((1)) FOR [Put]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_EntityRole_Delete]...'; + + +GO +ALTER TABLE [gba].[EntityRole] + ADD CONSTRAINT [DF_EntityRole_Delete] DEFAULT ((1)) FOR [Delete]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_Properties_PropertyId]...'; + + +GO +ALTER TABLE [gba].[Properties] + ADD CONSTRAINT [DF_Properties_PropertyId] DEFAULT (newid()) FOR [PropertyId]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF__Propertie__Displ__3D5E1FD2]...'; + + +GO +ALTER TABLE [gba].[Properties] + ADD CONSTRAINT [DF__Propertie__Displ__3D5E1FD2] DEFAULT (CONVERT([bit],(0))) FOR [DisplayInRelatedEntityBaseModel]; + + +GO +PRINT N'Creating Default Constraint [gba].[DF_Properties_IsReadOnly]...'; + + +GO +ALTER TABLE [gba].[Properties] + ADD CONSTRAINT [DF_Properties_IsReadOnly] DEFAULT ((0)) FOR [IsReadOnly]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_AbsenceCategory_AbsenceCategoryId]...'; + + +GO +ALTER TABLE [dbo].[AbsenceCategory] + ADD CONSTRAINT [DF_AbsenceCategory_AbsenceCategoryId] DEFAULT (newid()) FOR [AbsenceCategoryId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_AbsenceCategory_SalaryFactor]...'; + + +GO +ALTER TABLE [dbo].[AbsenceCategory] + ADD CONSTRAINT [DF_AbsenceCategory_SalaryFactor] DEFAULT ((1)) FOR [SalaryFactor]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_Department_DepartmentId]...'; + + +GO +ALTER TABLE [dbo].[Department] + ADD CONSTRAINT [DF_Department_DepartmentId] DEFAULT (newid()) FOR [DepartmentId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_Document_DocumentId]...'; + + +GO +ALTER TABLE [dbo].[Document] + ADD CONSTRAINT [DF_Document_DocumentId] DEFAULT (newid()) FOR [DocumentId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_Document_UploadedDate]...'; + + +GO +ALTER TABLE [dbo].[Document] + ADD CONSTRAINT [DF_Document_UploadedDate] DEFAULT (getdate()) FOR [UploadedDate]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_Employee_EmployeeId]...'; + + +GO +ALTER TABLE [dbo].[Employee] + ADD CONSTRAINT [DF_Employee_EmployeeId] DEFAULT (newid()) FOR [EmployeeId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_Employee_IsActive]...'; + + +GO +ALTER TABLE [dbo].[Employee] + ADD CONSTRAINT [DF_Employee_IsActive] DEFAULT ((1)) FOR [IsActive]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_EmployeeAbsence_EmployeeAbsenceId]...'; + + +GO +ALTER TABLE [dbo].[EmployeeAbsence] + ADD CONSTRAINT [DF_EmployeeAbsence_EmployeeAbsenceId] DEFAULT (newid()) FOR [EmployeeAbsenceId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_EmployeeAbsence_AbsenceStatus]...'; + + +GO +ALTER TABLE [dbo].[EmployeeAbsence] + ADD CONSTRAINT [DF_EmployeeAbsence_AbsenceStatus] DEFAULT ('InApproval') FOR [AbsenceStatus]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_EmployeeAbsenceDocument_EmployeeAbsenceDocumentId]...'; + + +GO +ALTER TABLE [dbo].[EmployeeAbsenceDocument] + ADD CONSTRAINT [DF_EmployeeAbsenceDocument_EmployeeAbsenceDocumentId] DEFAULT (newid()) FOR [EmployeeAbsenceDocumentId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_EmployeeAbsenceDocument_UploadedDate]...'; + + +GO +ALTER TABLE [dbo].[EmployeeAbsenceDocument] + ADD CONSTRAINT [DF_EmployeeAbsenceDocument_UploadedDate] DEFAULT (getdate()) FOR [UploadedDate]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_EmployeeDocument_EmployeeDocumentId]...'; + + +GO +ALTER TABLE [dbo].[EmployeeDocument] + ADD CONSTRAINT [DF_EmployeeDocument_EmployeeDocumentId] DEFAULT (newid()) FOR [EmployeeDocumentId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_EmployeeDocument_UploadedDate]...'; + + +GO +ALTER TABLE [dbo].[EmployeeDocument] + ADD CONSTRAINT [DF_EmployeeDocument_UploadedDate] DEFAULT (getdate()) FOR [UploadedDate]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_EmployeeJobHistory_EmployeeJobHistoryId]...'; + + +GO +ALTER TABLE [dbo].[EmployeeJobHistory] + ADD CONSTRAINT [DF_EmployeeJobHistory_EmployeeJobHistoryId] DEFAULT (newid()) FOR [EmployeeJobHistoryId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_EmployeeSalary_EmployeeSalaryId]...'; + + +GO +ALTER TABLE [dbo].[EmployeeSalary] + ADD CONSTRAINT [DF_EmployeeSalary_EmployeeSalaryId] DEFAULT (newid()) FOR [EmployeeSalaryId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_EmployeeSalary_SalaryType]...'; + + +GO +ALTER TABLE [dbo].[EmployeeSalary] + ADD CONSTRAINT [DF_EmployeeSalary_SalaryType] DEFAULT ('Monthly') FOR [SalaryType]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_Job_JobId]...'; + + +GO +ALTER TABLE [dbo].[Job] + ADD CONSTRAINT [DF_Job_JobId] DEFAULT (newid()) FOR [JobId]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_ResetPassword_Id]...'; + + +GO +ALTER TABLE [dbo].[ResetPassword] + ADD CONSTRAINT [DF_ResetPassword_Id] DEFAULT (newid()) FOR [Id]; + + +GO +PRINT N'Creating Default Constraint [dbo].[DF_Roles_Id]...'; + + +GO +ALTER TABLE [dbo].[Roles] + ADD CONSTRAINT [DF_Roles_Id] DEFAULT (newid()) FOR [Id]; + + +GO +PRINT N'Creating Foreign Key [gba].[FK_Endpoint_Entities]...'; + + +GO +ALTER TABLE [gba].[Endpoint] + ADD CONSTRAINT [FK_Endpoint_Entities] FOREIGN KEY ([StartingEntityId]) REFERENCES [gba].[Entities] ([EntityId]); + + +GO +PRINT N'Creating Foreign Key [gba].[FK_Endpoint_Roles]...'; + + +GO +ALTER TABLE [gba].[Endpoint] + ADD CONSTRAINT [FK_Endpoint_Roles] FOREIGN KEY ([RoleId]) REFERENCES [dbo].[Roles] ([Id]); + + +GO +PRINT N'Creating Foreign Key [gba].[FK_EndpointProperty_Endpoint]...'; + + +GO +ALTER TABLE [gba].[EndpointProperty] + ADD CONSTRAINT [FK_EndpointProperty_Endpoint] FOREIGN KEY ([EndpointId]) REFERENCES [gba].[Endpoint] ([EndpointId]); + + +GO +PRINT N'Creating Foreign Key [gba].[FK_EntityRelation_Entities_1]...'; + + +GO +ALTER TABLE [gba].[EntityRelation] + ADD CONSTRAINT [FK_EntityRelation_Entities_1] FOREIGN KEY ([Entity1Id]) REFERENCES [gba].[Entities] ([EntityId]); + + +GO +PRINT N'Creating Foreign Key [gba].[FK_EntityRelation_Entities_2]...'; + + +GO +ALTER TABLE [gba].[EntityRelation] + ADD CONSTRAINT [FK_EntityRelation_Entities_2] FOREIGN KEY ([Entity2Id]) REFERENCES [gba].[Entities] ([EntityId]); + + +GO +PRINT N'Creating Foreign Key [gba].[FK_EntityRole_Entities_EntitiesEntityId]...'; + + +GO +ALTER TABLE [gba].[EntityRole] + ADD CONSTRAINT [FK_EntityRole_Entities_EntitiesEntityId] FOREIGN KEY ([EntitiesEntityId]) REFERENCES [gba].[Entities] ([EntityId]) ON DELETE CASCADE; + + +GO +PRINT N'Creating Foreign Key [gba].[FK_EntityRole_Roles_RolesId]...'; + + +GO +ALTER TABLE [gba].[EntityRole] + ADD CONSTRAINT [FK_EntityRole_Roles_RolesId] FOREIGN KEY ([RolesId]) REFERENCES [dbo].[Roles] ([Id]) ON DELETE CASCADE; + + +GO +PRINT N'Creating Foreign Key [gba].[FK_Properties_Entities_EntityId]...'; + + +GO +ALTER TABLE [gba].[Properties] + ADD CONSTRAINT [FK_Properties_Entities_EntityId] FOREIGN KEY ([EntityId]) REFERENCES [gba].[Entities] ([EntityId]) ON DELETE CASCADE; + + +GO +PRINT N'Creating Foreign Key [gba].[FK_Properties_Entities_ReferencingEntityId]...'; + + +GO +ALTER TABLE [gba].[Properties] + ADD CONSTRAINT [FK_Properties_Entities_ReferencingEntityId] FOREIGN KEY ([ReferencingEntityId]) REFERENCES [gba].[Entities] ([EntityId]); + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_Accounts_Roles_RoleId]...'; + + +GO +ALTER TABLE [dbo].[Accounts] + ADD CONSTRAINT [FK_Accounts_Roles_RoleId] FOREIGN KEY ([RoleId]) REFERENCES [dbo].[Roles] ([Id]) ON DELETE CASCADE; + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_Employee_Department]...'; + + +GO +ALTER TABLE [dbo].[Employee] + ADD CONSTRAINT [FK_Employee_Department] FOREIGN KEY ([DepartmentId]) REFERENCES [dbo].[Department] ([DepartmentId]); + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_Employee_Employee]...'; + + +GO +ALTER TABLE [dbo].[Employee] + ADD CONSTRAINT [FK_Employee_Employee] FOREIGN KEY ([SuperiorId]) REFERENCES [dbo].[Employee] ([EmployeeId]); + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_Employee_Job]...'; + + +GO +ALTER TABLE [dbo].[Employee] + ADD CONSTRAINT [FK_Employee_Job] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job] ([JobId]); + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_EmployeeAbsence_AbsenceCategory]...'; + + +GO +ALTER TABLE [dbo].[EmployeeAbsence] + ADD CONSTRAINT [FK_EmployeeAbsence_AbsenceCategory] FOREIGN KEY ([AbsenceCategoryId]) REFERENCES [dbo].[AbsenceCategory] ([AbsenceCategoryId]); + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_EmployeeAbsence_Employee]...'; + + +GO +ALTER TABLE [dbo].[EmployeeAbsence] + ADD CONSTRAINT [FK_EmployeeAbsence_Employee] FOREIGN KEY ([EmployeeAbsenceId]) REFERENCES [dbo].[Employee] ([EmployeeId]); + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_EmployeeAbsenceDocument_EmployeeAbsence]...'; + + +GO +ALTER TABLE [dbo].[EmployeeAbsenceDocument] + ADD CONSTRAINT [FK_EmployeeAbsenceDocument_EmployeeAbsence] FOREIGN KEY ([EmployeeAbsenceId]) REFERENCES [dbo].[EmployeeAbsence] ([EmployeeAbsenceId]); + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_EmployeeJobHistory_Employee]...'; + + +GO +ALTER TABLE [dbo].[EmployeeJobHistory] + ADD CONSTRAINT [FK_EmployeeJobHistory_Employee] FOREIGN KEY ([EmployeeId]) REFERENCES [dbo].[Employee] ([EmployeeId]); + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_EmployeeJobHistory_Job]...'; + + +GO +ALTER TABLE [dbo].[EmployeeJobHistory] + ADD CONSTRAINT [FK_EmployeeJobHistory_Job] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job] ([JobId]); + + +GO +PRINT N'Creating Foreign Key [dbo].[FK_EmployeeSalary_Employee]...'; + + +GO +ALTER TABLE [dbo].[EmployeeSalary] + ADD CONSTRAINT [FK_EmployeeSalary_Employee] FOREIGN KEY ([EmployeeId]) REFERENCES [dbo].[Employee] ([EmployeeId]); + + +INSERT [dbo].[Roles] ([Id], [RoleName], [RoleDescription]) VALUES (N'e66693a9-f822-4aa9-b061-d7c5656b8142', N'admin', N'Main administrator role.') +GO +INSERT [dbo].[Accounts] ([Username], [EmailAddress], [PasswordHash], [RoleId]) VALUES (N'test', N'test@test.test', 0x9D7624149040E53C867B720D23589AE2F3BDF7E19DABB23206158FBB293F2C491A543EB4, N'e66693a9-f822-4aa9-b061-d7c5656b8142') +GO + +-- HR management system entities definition + +INSERT [gba].[Entities] ([EntityId], [ControllerName], [TableName], [ObjectName], [SoftDeleteColumn]) VALUES (N'f6b6a7ca-8ecc-4aa9-9c50-095fe467e971', N'employee-absence', N'EmployeeAbsence', NULL, NULL) +GO +INSERT [gba].[Entities] ([EntityId], [ControllerName], [TableName], [ObjectName], [SoftDeleteColumn]) VALUES (N'202f74da-7cb1-4685-b403-1d8e86cb9702', N'department', N'Department', NULL, NULL) +GO +INSERT [gba].[Entities] ([EntityId], [ControllerName], [TableName], [ObjectName], [SoftDeleteColumn]) VALUES (N'e896731e-c7ba-4046-861f-329980dbebae', NULL, N'Employee', N'Manager', NULL) +GO +INSERT [gba].[Entities] ([EntityId], [ControllerName], [TableName], [ObjectName], [SoftDeleteColumn]) VALUES (N'70764ca2-f297-4559-b443-35a3a683a945', N'employee', N'Employee', NULL, NULL) +GO +INSERT [gba].[Entities] ([EntityId], [ControllerName], [TableName], [ObjectName], [SoftDeleteColumn]) VALUES (N'70b094c9-6b42-4b56-ac16-4c6c01c2e238', N'job', N'Job', NULL, NULL) +GO +INSERT [gba].[Entities] ([EntityId], [ControllerName], [TableName], [ObjectName], [SoftDeleteColumn]) VALUES (N'e9b86f01-5754-4efe-b6d8-5bda2709de9c', NULL, N'Employee', N'EmployeeBasicData', NULL) +GO +INSERT [gba].[Entities] ([EntityId], [ControllerName], [TableName], [ObjectName], [SoftDeleteColumn]) VALUES (N'7faab2cb-8157-4689-980b-865b3e9850c9', N'absence-category', N'AbsenceCategory', NULL, NULL) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'69046c32-89b6-469d-9352-003b4fe7dafa', N'AbsenceCategoryId', N'f6b6a7ca-8ecc-4aa9-9c50-095fe467e971', N'7faab2cb-8157-4689-980b-865b3e9850c9', 0, 1, NULL, 0, N'AbsenceCategory', 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'f9ad5f4a-e797-4a52-8760-1d4c230b7c36', N'DateTo', N'f6b6a7ca-8ecc-4aa9-9c50-095fe467e971', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'fe99b6c6-19b2-4579-ba21-23119d05a043', N'LastName', N'e9b86f01-5754-4efe-b6d8-5bda2709de9c', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'6725ac0f-c48e-4a35-8638-2415d0de9c53', N'Name', N'202f74da-7cb1-4685-b403-1d8e86cb9702', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'f812297a-5375-4576-87eb-2e87222ab26b', N'EmployeeAbsenceId', N'f6b6a7ca-8ecc-4aa9-9c50-095fe467e971', NULL, 1, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'e28737c1-9f62-46ac-94ef-2f73ff4edde9', N'DepartmentId', N'70764ca2-f297-4559-b443-35a3a683a945', N'202f74da-7cb1-4685-b403-1d8e86cb9702', 0, 1, NULL, 0, N'Department', 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'd4837fef-65e9-4426-98d3-3b5f6683717d', N'EmployeeId', N'e9b86f01-5754-4efe-b6d8-5bda2709de9c', NULL, 1, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'a4e38ea6-6b3c-4ab6-8fe0-3d45c39007f9', N'LastName', N'e896731e-c7ba-4046-861f-329980dbebae', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'c006fae6-f5dc-451b-bf47-41601640477e', N'EmployeeId', N'e896731e-c7ba-4046-861f-329980dbebae', NULL, 1, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'b7de3bae-6511-4dc7-afa4-4183603f64ae', N'Description', N'7faab2cb-8157-4689-980b-865b3e9850c9', NULL, 0, 0, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'c7bea45b-814f-4d77-a71e-4282b449de1a', N'LastName', N'70764ca2-f297-4559-b443-35a3a683a945', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'9d19d6ce-72c9-45c9-ae51-454beb9fa22e', N'JobId', N'70764ca2-f297-4559-b443-35a3a683a945', N'70b094c9-6b42-4b56-ac16-4c6c01c2e238', 0, 0, NULL, 0, N'Job', 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'ee332ff8-0b05-476e-a1fd-460c24bf25fb', N'SuperiorId', N'70764ca2-f297-4559-b443-35a3a683a945', N'e896731e-c7ba-4046-861f-329980dbebae', 0, 1, N'Subordinates', 0, N'Manager', 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'e580f17d-f6ce-438f-8549-4cc942755481', N'LastName', N'e9b86f01-5754-4efe-b6d8-5bda2709de9c', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'9022da02-c43f-4aa1-9f3d-4de34da04e37', N'Name', N'70b094c9-6b42-4b56-ac16-4c6c01c2e238', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'a5a1d9a7-3197-4c47-a92c-57c3aa92ffb0', N'FirstName', N'e896731e-c7ba-4046-861f-329980dbebae', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'a3788ae3-e139-4f79-a449-5c9c0f162006', N'DepartmentId', N'202f74da-7cb1-4685-b403-1d8e86cb9702', NULL, 1, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'241c6b66-9cc0-40c8-b00d-6aafacf4f6dc', N'MiddleName', N'70764ca2-f297-4559-b443-35a3a683a945', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'a61d2a36-f855-44a7-a7cf-8478005f5432', N'Description', N'202f74da-7cb1-4685-b403-1d8e86cb9702', NULL, 0, 0, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'075c15d0-52be-4353-b146-907bcd6c6dec', N'SalaryFactor', N'7faab2cb-8157-4689-980b-865b3e9850c9', NULL, 0, 0, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'af55e83b-2e1e-486f-a7c7-9ca861db9155', N'AbsenceCategoryId', N'7faab2cb-8157-4689-980b-865b3e9850c9', NULL, 1, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'beec5e1b-ea6d-4927-9b4a-9e1cb5af4c67', N'DateFrom', N'f6b6a7ca-8ecc-4aa9-9c50-095fe467e971', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'acbc7663-ad01-44c0-ad64-a93ed11b4962', N'MiddleName', N'e896731e-c7ba-4046-861f-329980dbebae', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'd1f7456d-2e78-4be6-8935-aaffceb21db2', N'AbsenceStatus', N'f6b6a7ca-8ecc-4aa9-9c50-095fe467e971', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'779d3774-a6a7-49df-aabb-b610dcba492e', N'EmployeeId', N'70764ca2-f297-4559-b443-35a3a683a945', NULL, 1, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'2ccd9131-d20b-4612-8277-bb385483befc', N'EmployeeId', N'f6b6a7ca-8ecc-4aa9-9c50-095fe467e971', N'e9b86f01-5754-4efe-b6d8-5bda2709de9c', 0, 1, NULL, 0, N'Employee', 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'b28f3ca4-f1fd-492c-aef6-c8c3e52a44c5', N'Name', N'7faab2cb-8157-4689-980b-865b3e9850c9', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'9d75fc8b-6eca-4e55-88a2-cea9600664a1', N'JobId', N'70b094c9-6b42-4b56-ac16-4c6c01c2e238', NULL, 1, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'115903d2-c86b-4581-a077-d3fdef570ee6', N'EmployedFrom', N'70764ca2-f297-4559-b443-35a3a683a945', NULL, 0, 0, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'677ca234-1abf-4e7f-833f-d6a3468e0a8f', N'EmployeeType', N'70764ca2-f297-4559-b443-35a3a683a945', NULL, 0, 1, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'748e6882-eb51-4cf7-b417-de5255d2e5c7', N'VacationDays', N'70764ca2-f297-4559-b443-35a3a683a945', NULL, 0, 0, NULL, 0, NULL, 0) +GO +INSERT [gba].[Properties] ([PropertyId], [PropertyName], [EntityId], [ReferencingEntityId], [IsKey], [UseInBaseModel], [RelatedModelPropertyName], [DisplayInRelatedEntityBaseModel], [ModelPropertyName], [IsReadOnly]) VALUES (N'4d95c205-0769-4b39-87d2-e076158f56c1', N'FirstName', N'70764ca2-f297-4559-b443-35a3a683a945', NULL, 0, 1, NULL, 0, NULL, 0) +GO diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e3aef38 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.4' + +services: + genericbackend: + image: ${DOCKER_REGISTRY-}begeneric + build: + context: . + dockerfile: BeGeneric/Dockerfile + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://+:80 + ports: + - 8888:80 + volumes: + - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro + - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro + db: + image: ${DOCKER_REGISTRY-}begenericdb + ports: + - 1433:1433 + build: + dockerfile: BeGeneric/sql/Dockerfile + + + \ No newline at end of file From 616918ae377cf322a2ecb202ccdcc07cdab24344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uro=C5=A1=20Verhovnik?= <56766664+VerhovnikU@users.noreply.github.com> Date: Fri, 3 Feb 2023 14:22:49 +0100 Subject: [PATCH 3/8] Create docker-image.yml --- .github/workflows/docker-image.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..0f10615 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker-compose up From 3a0f81a6d9168440467c2a42b38836938c48e216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uro=C5=A1=20Verhovnik?= <56766664+VerhovnikU@users.noreply.github.com> Date: Fri, 3 Feb 2023 14:55:54 +0100 Subject: [PATCH 4/8] Update docker-compose.yml --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e3aef38..2fa3b02 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.4' services: genericbackend: - image: ${DOCKER_REGISTRY-}begeneric + image: begeneric build: context: . dockerfile: BeGeneric/Dockerfile @@ -15,11 +15,11 @@ services: - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro db: - image: ${DOCKER_REGISTRY-}begenericdb + image: begenericdb ports: - 1433:1433 build: dockerfile: BeGeneric/sql/Dockerfile - \ No newline at end of file + From 7818d5eca185bf816bb631623bda3c2a284e4626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uro=C5=A1=20Verhovnik?= <56766664+VerhovnikU@users.noreply.github.com> Date: Fri, 3 Feb 2023 15:01:04 +0100 Subject: [PATCH 5/8] Update docker-image.yml --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0f10615..1b24269 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,4 +15,4 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Docker image - run: docker-compose up + run: docker-compose --verbose up -d db From 123885cf0a02fed003e479d3e015ad01b151d32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uro=C5=A1=20Verhovnik?= <56766664+VerhovnikU@users.noreply.github.com> Date: Fri, 3 Feb 2023 15:09:55 +0100 Subject: [PATCH 6/8] Delete .github/workflows directory --- .github/workflows/docker-image.yml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 1b24269..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker-compose --verbose up -d db From 6f3137293fb861f9766fc2bbb4fe921159b30d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uro=C5=A1=20Verhovnik?= <56766664+VerhovnikU@users.noreply.github.com> Date: Fri, 3 Feb 2023 15:10:26 +0100 Subject: [PATCH 7/8] Create docker-image.yml --- .github/workflows/docker-image.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..888e99c --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file BeGeneric/Dockerfile --tag beGeneric:$(date +%s) From 820c2dba0f04d70560e3fae965ce7c4628e54690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uro=C5=A1=20Verhovnik?= <56766664+VerhovnikU@users.noreply.github.com> Date: Fri, 3 Feb 2023 15:11:06 +0100 Subject: [PATCH 8/8] Update docker-image.yml --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 888e99c..6fa2b25 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,4 +15,4 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Docker image - run: docker build . --file BeGeneric/Dockerfile --tag beGeneric:$(date +%s) + run: docker build . --file BeGeneric/Dockerfile --tag begeneric:$(date +%s)