Geojson DATA Operation change to Stable - Daniel C No.7
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
on-profile: prod
|
||||
|
||||
jpa:
|
||||
show-sql: false
|
||||
|
||||
@@ -22,7 +22,7 @@ spring:
|
||||
leak-detection-threshold: 60000
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: update # 테이블이 없으면 생성, 있으면 업데이트
|
||||
ddl-auto: validate # 스키마 검증만 수행, 자동 변경하지 않음 (안전)
|
||||
properties:
|
||||
hibernate:
|
||||
jdbc:
|
||||
|
||||
@@ -4,11 +4,25 @@
|
||||
-- 1. First ensure PostGIS is enabled
|
||||
CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
|
||||
-- 2. Clear existing data since it's in incorrect format (JTS serialized objects)
|
||||
-- This data needs to be reprocessed anyway with the correct PostGIS approach
|
||||
DELETE FROM public.tb_map_sheet_learn_data_geom;
|
||||
-- 2. Check if column needs to be recreated (only if it's bytea type)
|
||||
-- Only clear data if the column type is incorrect and needs conversion
|
||||
DO $$
|
||||
BEGIN
|
||||
-- Only delete data if geom column exists and is bytea type
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name = 'tb_map_sheet_learn_data_geom'
|
||||
AND column_name = 'geom'
|
||||
AND data_type = 'bytea'
|
||||
) THEN
|
||||
DELETE FROM public.tb_map_sheet_learn_data_geom WHERE geom IS NOT NULL;
|
||||
RAISE NOTICE 'Cleared incorrect bytea geometry data for conversion';
|
||||
ELSE
|
||||
RAISE NOTICE 'Geometry column is already correct type, skipping data deletion';
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- 3. Drop and recreate the geom column with correct PostGIS geometry type
|
||||
-- 3. Drop and recreate the geom column with correct PostGIS geometry type (only if needed)
|
||||
ALTER TABLE public.tb_map_sheet_learn_data_geom DROP COLUMN IF EXISTS geom;
|
||||
ALTER TABLE public.tb_map_sheet_learn_data_geom ADD COLUMN geom geometry(Polygon, 5186);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user