feat(ft546): enforce shadow database isolation
This commit is contained in:
77
sql/shadow/V001__ft546_shadow_read_views.sql
Normal file
77
sql/shadow/V001__ft546_shadow_read_views.sql
Normal file
@@ -0,0 +1,77 @@
|
||||
:setvar ShadowSourceDatabase "FT546-wcs"
|
||||
|
||||
SET NOCOUNT ON;
|
||||
SET XACT_ABORT ON;
|
||||
GO
|
||||
|
||||
IF DB_ID() <> DB_ID(N'$(ShadowSourceDatabase)')
|
||||
THROW 51000, 'Run the shadow read-view script only in ShadowSourceDatabase.', 1;
|
||||
GO
|
||||
|
||||
IF SCHEMA_ID(N'shadow_ro') IS NULL
|
||||
EXEC(N'CREATE SCHEMA shadow_ro AUTHORIZATION dbo');
|
||||
GO
|
||||
|
||||
CREATE OR ALTER VIEW shadow_ro.v_wcs_srgv_queue
|
||||
AS
|
||||
SELECT guid, task_no, task_type, priority, cargo, issued, path_info,
|
||||
execution_status, cargo_pick_site, cargo_place_site, start_site,
|
||||
end_site, the_floor, trun_path, up_down_site, create_date,
|
||||
start_date, finish_date, agv_id, default02, default03, default04,
|
||||
default05, default06, default07, default08
|
||||
FROM dbo.wcs_srgv_queue;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER VIEW shadow_ro.v_wcs_srgv_queue_finish
|
||||
AS
|
||||
SELECT guid, task_no, task_type, priority, cargo, issued, path_info,
|
||||
execution_status, cargo_pick_site, cargo_place_site, start_site,
|
||||
end_site, the_floor, trun_path, up_down_site, create_date,
|
||||
start_date, finish_date, agv_id, default02, default03, default04,
|
||||
default05, default06, default07, default08
|
||||
FROM dbo.wcs_srgv_queue_finish;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER VIEW shadow_ro.v_device_srgv
|
||||
AS
|
||||
SELECT guid, device_id, device_name, type, set_floor, power_time,
|
||||
last_time, agv_status, task_no, src_site, tar_site, curr_site,
|
||||
task_type, battery, work_mode, alarm, status, finish, charge_flag,
|
||||
work_phase, err_msg, ssj_request, change_layer, cargo_flag,
|
||||
manual_charge, path, allow_send, curr_floor, offline_site, locked,
|
||||
spare1, spare2, spare3, spare4, spare5
|
||||
FROM dbo.device_srgv;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER VIEW shadow_ro.v_wcs_srgv_map
|
||||
AS
|
||||
SELECT guid, x, y, z, axy, value, ux, uy, uz, uxy, space_name, remark,
|
||||
cargo_space_id, the_row, the_column, the_layer, site_id, plc_row,
|
||||
plc_column, plc_layer, warehouse, space_area
|
||||
FROM dbo.wcs_srgv_map;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER VIEW shadow_ro.v_bas_cargo_space
|
||||
AS
|
||||
SELECT cargo_space_id, warehouse_id, roadway_id, cargo_area_id, the_type,
|
||||
the_type_name, cargo_space_name, the_platoon, the_column, the_floor,
|
||||
status, locked, tray_code, cargo_hight, iss_double, group_coding_no,
|
||||
group_coding, cargo_space_logo, this_cargo_area, wms_cargo_space_id
|
||||
FROM dbo.bas_cargo_space;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER VIEW shadow_ro.v_tsj_execution
|
||||
AS
|
||||
SELECT guid, device_id, device_name, task_no, src_row, src_column,
|
||||
src_layer, tar_row, tar_column, tar_layer, src_site, tar_site,
|
||||
send_flag, send_type, task_type, create_date, start_date,
|
||||
finish_date, spare1, spare2, spare3, rwlx
|
||||
FROM dbo.tsj_device_execution_queue;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER VIEW shadow_ro.v_current_database_clock
|
||||
AS
|
||||
SELECT SYSUTCDATETIME() AS database_utc_time,
|
||||
DB_NAME() AS database_name,
|
||||
@@SERVERNAME AS server_name;
|
||||
GO
|
||||
Reference in New Issue
Block a user