Modify of database

This commit is contained in:
Astrian Zheng 2023-09-15 08:19:09 +10:00
parent 0189ffa50b
commit d9208917f3
7 changed files with 22 additions and 17 deletions

Binary file not shown.

View File

@ -158,6 +158,7 @@
<Property Name="displayName" Type="varchar(max)" Nullable="true" /> <Property Name="displayName" Type="varchar(max)" Nullable="true" />
<Property Name="avatar" Type="varchar(max)" Nullable="true" /> <Property Name="avatar" Type="varchar(max)" Nullable="true" />
<Property Name="role" Type="int" Nullable="true" /> <Property Name="role" Type="int" Nullable="true" />
<Property Name="status" Type="smallint" Nullable="false" />
</EntityType> </EntityType>
<Association Name="FK__Appointme__patie__5AEE82B9"> <Association Name="FK__Appointme__patie__5AEE82B9">
<End Role="Patients" Type="FIT5032Assignment.Store.Patients" Multiplicity="0..1" /> <End Role="Patients" Type="FIT5032Assignment.Store.Patients" Multiplicity="0..1" />
@ -435,6 +436,7 @@
<NavigationProperty Name="Doctors" Relationship="Self.FK__Doctors__user__5441852A" FromRole="Users" ToRole="Doctors" /> <NavigationProperty Name="Doctors" Relationship="Self.FK__Doctors__user__5441852A" FromRole="Users" ToRole="Doctors" />
<NavigationProperty Name="Patients" Relationship="Self.FK__Patients__user__5165187F" FromRole="Users" ToRole="Patients" /> <NavigationProperty Name="Patients" Relationship="Self.FK__Patients__user__5165187F" FromRole="Users" ToRole="Patients" />
<NavigationProperty Name="Sessions" Relationship="Self.FK__Sessions__user__4E88ABD4" FromRole="Users" ToRole="Sessions" /> <NavigationProperty Name="Sessions" Relationship="Self.FK__Sessions__user__4E88ABD4" FromRole="Users" ToRole="Sessions" />
<Property Name="status" Type="Int16" Nullable="false" />
</EntityType> </EntityType>
<Association Name="FK__Appointme__patie__5AEE82B9"> <Association Name="FK__Appointme__patie__5AEE82B9">
<End Role="Patients" Type="Self.Patients" Multiplicity="0..1" /> <End Role="Patients" Type="Self.Patients" Multiplicity="0..1" />
@ -758,6 +760,7 @@
<ScalarProperty Name="displayName" ColumnName="displayName" /> <ScalarProperty Name="displayName" ColumnName="displayName" />
<ScalarProperty Name="avatar" ColumnName="avatar" /> <ScalarProperty Name="avatar" ColumnName="avatar" />
<ScalarProperty Name="role" ColumnName="role" /> <ScalarProperty Name="role" ColumnName="role" />
<ScalarProperty Name="status" ColumnName="status" />
</MappingFragment> </MappingFragment>
</EntityTypeMapping> </EntityTypeMapping>
</EntitySetMapping> </EntitySetMapping>

View File

@ -2,13 +2,13 @@
-- -------------------------------------------------- -- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure -- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
-- -------------------------------------------------- -- --------------------------------------------------
-- Date Created: 09/14/2023 16:21:56 -- Date Created: 09/15/2023 08:16:24
-- Generated from EDMX file: C:\Users\astri\source\repos\FIT5032-Assignment\FIT5032-Assignment\Models\FIT5032-Assignment.edmx -- Generated from EDMX file: C:\Users\astri\source\repos\FIT5032-Assignment\FIT5032-Assignment\Models\FIT5032-Assignment.edmx
-- -------------------------------------------------- -- --------------------------------------------------
SET QUOTED_IDENTIFIER OFF; SET QUOTED_IDENTIFIER OFF;
GO GO
USE [Database1]; USE [FIT5032_Assignment];
GO GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]'); IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO GO
@ -23,39 +23,39 @@ GO
IF OBJECT_ID(N'[dbo].[FK__Appointme__respo__5BE2A6F2]', 'F') IS NOT NULL IF OBJECT_ID(N'[dbo].[FK__Appointme__respo__5BE2A6F2]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK__Appointme__respo__5BE2A6F2]; ALTER TABLE [dbo].[Appointments] DROP CONSTRAINT [FK__Appointme__respo__5BE2A6F2];
GO GO
IF OBJECT_ID(N'[dbo].[FK__Images__appointm__60A75C0F]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Images] DROP CONSTRAINT [FK__Images__appointm__60A75C0F];
GO
IF OBJECT_ID(N'[dbo].[FK__Reviews__appoint__6383C8BA]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Reviews] DROP CONSTRAINT [FK__Reviews__appoint__6383C8BA];
GO
IF OBJECT_ID(N'[dbo].[FK__Credential__user__4BAC3F29]', 'F') IS NOT NULL IF OBJECT_ID(N'[dbo].[FK__Credential__user__4BAC3F29]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Credentials] DROP CONSTRAINT [FK__Credential__user__4BAC3F29]; ALTER TABLE [dbo].[Credentials] DROP CONSTRAINT [FK__Credential__user__4BAC3F29];
GO GO
IF OBJECT_ID(N'[dbo].[FK__Doctors__user__5441852A]', 'F') IS NOT NULL IF OBJECT_ID(N'[dbo].[FK__Doctors__user__5441852A]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Doctors] DROP CONSTRAINT [FK__Doctors__user__5441852A]; ALTER TABLE [dbo].[Doctors] DROP CONSTRAINT [FK__Doctors__user__5441852A];
GO GO
IF OBJECT_ID(N'[dbo].[FK__Images__appointm__60A75C0F]', 'F') IS NOT NULL IF OBJECT_ID(N'[dbo].[FK__Images__responsi__5FB337D6]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Images] DROP CONSTRAINT [FK__Images__appointm__60A75C0F]; ALTER TABLE [dbo].[Images] DROP CONSTRAINT [FK__Images__responsi__5FB337D6];
GO
IF OBJECT_ID(N'[dbo].[FK__Reviews__doctor__656C112C]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Reviews] DROP CONSTRAINT [FK__Reviews__doctor__656C112C];
GO GO
IF OBJECT_ID(N'[dbo].[FK__Images__patient__5EBF139D]', 'F') IS NOT NULL IF OBJECT_ID(N'[dbo].[FK__Images__patient__5EBF139D]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Images] DROP CONSTRAINT [FK__Images__patient__5EBF139D]; ALTER TABLE [dbo].[Images] DROP CONSTRAINT [FK__Images__patient__5EBF139D];
GO GO
IF OBJECT_ID(N'[dbo].[FK__Images__responsi__5FB337D6]', 'F') IS NOT NULL IF OBJECT_ID(N'[dbo].[FK__ShareURLs__image__68487DD7]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Images] DROP CONSTRAINT [FK__Images__responsi__5FB337D6]; ALTER TABLE [dbo].[ShareURLs] DROP CONSTRAINT [FK__ShareURLs__image__68487DD7];
GO GO
IF OBJECT_ID(N'[dbo].[FK__Patients__user__5165187F]', 'F') IS NOT NULL IF OBJECT_ID(N'[dbo].[FK__Patients__user__5165187F]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Patients] DROP CONSTRAINT [FK__Patients__user__5165187F]; ALTER TABLE [dbo].[Patients] DROP CONSTRAINT [FK__Patients__user__5165187F];
GO GO
IF OBJECT_ID(N'[dbo].[FK__Reviews__appoint__6383C8BA]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Reviews] DROP CONSTRAINT [FK__Reviews__appoint__6383C8BA];
GO
IF OBJECT_ID(N'[dbo].[FK__Reviews__doctor__656C112C]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Reviews] DROP CONSTRAINT [FK__Reviews__doctor__656C112C];
GO
IF OBJECT_ID(N'[dbo].[FK__Reviews__patient__6477ECF3]', 'F') IS NOT NULL IF OBJECT_ID(N'[dbo].[FK__Reviews__patient__6477ECF3]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Reviews] DROP CONSTRAINT [FK__Reviews__patient__6477ECF3]; ALTER TABLE [dbo].[Reviews] DROP CONSTRAINT [FK__Reviews__patient__6477ECF3];
GO GO
IF OBJECT_ID(N'[dbo].[FK__Sessions__user__4E88ABD4]', 'F') IS NOT NULL IF OBJECT_ID(N'[dbo].[FK__Sessions__user__4E88ABD4]', 'F') IS NOT NULL
ALTER TABLE [dbo].[Sessions] DROP CONSTRAINT [FK__Sessions__user__4E88ABD4]; ALTER TABLE [dbo].[Sessions] DROP CONSTRAINT [FK__Sessions__user__4E88ABD4];
GO GO
IF OBJECT_ID(N'[dbo].[FK__ShareURLs__image__68487DD7]', 'F') IS NOT NULL
ALTER TABLE [dbo].[ShareURLs] DROP CONSTRAINT [FK__ShareURLs__image__68487DD7];
GO
-- -------------------------------------------------- -- --------------------------------------------------
-- Dropping existing tables -- Dropping existing tables
@ -180,7 +180,8 @@ CREATE TABLE [dbo].[Users] (
[uuid] varchar(36) NOT NULL, [uuid] varchar(36) NOT NULL,
[displayName] varchar(max) NULL, [displayName] varchar(max) NULL,
[avatar] varchar(max) NULL, [avatar] varchar(max) NULL,
[role] int NULL [role] int NULL,
[status] smallint NOT NULL
); );
GO GO

View File

@ -25,6 +25,7 @@ namespace FIT5032_Assignment.Models
public string displayName { get; set; } public string displayName { get; set; }
public string avatar { get; set; } public string avatar { get; set; }
public Nullable<int> role { get; set; } public Nullable<int> role { get; set; }
public short status { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Credentials> Credentials { get; set; } public virtual ICollection<Credentials> Credentials { get; set; }

View File

@ -61,7 +61,7 @@
</compilers> </compilers>
</system.codedom> </system.codedom>
<connectionStrings> <connectionStrings>
<add name="Database1Entities" connectionString="metadata=res://*/Models.FIT5032-Assignment.csdl|res://*/Models.FIT5032-Assignment.ssdl|res://*/Models.FIT5032-Assignment.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\Database1.mdf;integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> <add name="Database1Entities" connectionString="metadata=res://*/Models.FIT5032-Assignment.csdl|res://*/Models.FIT5032-Assignment.ssdl|res://*/Models.FIT5032-Assignment.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\FIT5032_Assignment.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings> </connectionStrings>
<entityFramework> <entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">