chore: cms sync
This commit is contained in:
@@ -126,9 +126,9 @@ fields:
|
||||
schema:
|
||||
name: id
|
||||
table: client_users
|
||||
data_type: char
|
||||
data_type: uuid
|
||||
default_value: null
|
||||
max_length: 36
|
||||
max_length: null
|
||||
numeric_precision: null
|
||||
numeric_scale: null
|
||||
is_nullable: false
|
||||
@@ -304,7 +304,7 @@ fields:
|
||||
foreign_key_column: null
|
||||
- collection: client_users
|
||||
field: company
|
||||
type: string
|
||||
type: uuid
|
||||
meta:
|
||||
collection: client_users
|
||||
conditions: null
|
||||
@@ -328,9 +328,9 @@ fields:
|
||||
schema:
|
||||
name: company
|
||||
table: client_users
|
||||
data_type: char
|
||||
data_type: uuid
|
||||
default_value: null
|
||||
max_length: 36
|
||||
max_length: null
|
||||
numeric_precision: null
|
||||
numeric_scale: null
|
||||
is_nullable: true
|
||||
@@ -450,9 +450,9 @@ fields:
|
||||
schema:
|
||||
name: id
|
||||
table: companies
|
||||
data_type: char
|
||||
data_type: uuid
|
||||
default_value: null
|
||||
max_length: 36
|
||||
max_length: null
|
||||
numeric_precision: null
|
||||
numeric_scale: null
|
||||
is_nullable: false
|
||||
@@ -617,7 +617,7 @@ fields:
|
||||
width: full
|
||||
- collection: directus_users
|
||||
field: company
|
||||
type: string
|
||||
type: uuid
|
||||
meta:
|
||||
collection: directus_users
|
||||
conditions: null
|
||||
@@ -641,9 +641,9 @@ fields:
|
||||
schema:
|
||||
name: company
|
||||
table: directus_users
|
||||
data_type: char
|
||||
data_type: uuid
|
||||
default_value: null
|
||||
max_length: 36
|
||||
max_length: null
|
||||
numeric_precision: null
|
||||
numeric_scale: null
|
||||
is_nullable: true
|
||||
@@ -869,7 +869,7 @@ fields:
|
||||
foreign_key_column: null
|
||||
- collection: visual_feedback
|
||||
field: user_created
|
||||
type: string
|
||||
type: uuid
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
conditions: null
|
||||
@@ -894,9 +894,9 @@ fields:
|
||||
schema:
|
||||
name: user_created
|
||||
table: visual_feedback
|
||||
data_type: char
|
||||
data_type: uuid
|
||||
default_value: null
|
||||
max_length: 36
|
||||
max_length: null
|
||||
numeric_precision: null
|
||||
numeric_scale: null
|
||||
is_nullable: true
|
||||
@@ -934,9 +934,9 @@ fields:
|
||||
schema:
|
||||
name: screenshot
|
||||
table: visual_feedback
|
||||
data_type: char
|
||||
data_type: uuid
|
||||
default_value: null
|
||||
max_length: 36
|
||||
max_length: null
|
||||
numeric_precision: null
|
||||
numeric_scale: null
|
||||
is_nullable: true
|
||||
@@ -950,7 +950,7 @@ fields:
|
||||
foreign_key_column: null
|
||||
- collection: visual_feedback
|
||||
field: company
|
||||
type: string
|
||||
type: uuid
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
conditions: null
|
||||
@@ -974,9 +974,9 @@ fields:
|
||||
schema:
|
||||
name: company
|
||||
table: visual_feedback
|
||||
data_type: char
|
||||
data_type: uuid
|
||||
default_value: null
|
||||
max_length: 36
|
||||
max_length: null
|
||||
numeric_precision: null
|
||||
numeric_scale: null
|
||||
is_nullable: true
|
||||
@@ -1072,7 +1072,7 @@ fields:
|
||||
foreign_key_column: null
|
||||
- collection: visual_feedback_comments
|
||||
field: user_created
|
||||
type: string
|
||||
type: uuid
|
||||
meta:
|
||||
collection: visual_feedback_comments
|
||||
conditions: null
|
||||
@@ -1097,9 +1097,9 @@ fields:
|
||||
schema:
|
||||
name: user_created
|
||||
table: visual_feedback_comments
|
||||
data_type: char
|
||||
data_type: uuid
|
||||
default_value: null
|
||||
max_length: 36
|
||||
max_length: null
|
||||
numeric_precision: null
|
||||
numeric_scale: null
|
||||
is_nullable: true
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
# Configuration
|
||||
PROJECT="infra-cms"
|
||||
SCHEMA_PATH="./packages/cms-infra/schema/snapshot.yaml"
|
||||
CMD_PREFIX="docker-compose -f packages/cms-infra/docker-compose.yml"
|
||||
LOCAL_SCHEMA_PATH="./packages/cms-infra/schema/snapshot.yaml"
|
||||
REMOTE_HOST="root@infra.mintel.me"
|
||||
REMOTE_DIR="/opt/infra/directus"
|
||||
|
||||
@@ -16,7 +15,6 @@ fi
|
||||
|
||||
case $ENV in
|
||||
local)
|
||||
# Default to infra-cms package for at-mintel
|
||||
PROJECT="infra-cms"
|
||||
CMD_PREFIX="docker-compose -f packages/cms-infra/docker-compose.yml"
|
||||
|
||||
@@ -31,26 +29,33 @@ case $ENV in
|
||||
;;
|
||||
infra)
|
||||
# 'infra' is the remote production server for at-mintel
|
||||
PROJECT="directus" # Remote project name is usually 'directus' in docker-compose
|
||||
|
||||
echo "📤 Uploading snapshot to REMOTE $ENV..."
|
||||
# Ensure remote directory exists
|
||||
ssh "$REMOTE_HOST" "mkdir -p $REMOTE_DIR/directus/schema"
|
||||
scp ./packages/cms-infra/schema/snapshot.yaml "$REMOTE_HOST:$REMOTE_DIR/directus/schema/snapshot.yaml"
|
||||
PROJECT="directus" # Remote project name
|
||||
|
||||
echo "🔍 Detecting remote container..."
|
||||
REMOTE_CONTAINER=$(ssh "$REMOTE_HOST" "cd $REMOTE_DIR && docker compose -p $PROJECT ps -q directus")
|
||||
REMOTE_CONTAINER=$(ssh "$REMOTE_HOST" "docker ps --filter label=com.docker.compose.project=$PROJECT --filter label=com.docker.compose.service=directus -q")
|
||||
|
||||
if [ -z "$REMOTE_CONTAINER" ]; then
|
||||
# Fallback to older name if labels fail
|
||||
REMOTE_CONTAINER=$(ssh "$REMOTE_HOST" "docker ps -f name=directus-directus-1 -q")
|
||||
fi
|
||||
|
||||
if [ -z "$REMOTE_CONTAINER" ]; then
|
||||
echo "❌ Remote container for $ENV not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📤 Injecting snapshot directly into container $REMOTE_CONTAINER..."
|
||||
# Inject file via stdin to avoid needing a host-side mount or scp path matching
|
||||
ssh "$REMOTE_HOST" "docker exec -i $REMOTE_CONTAINER sh -c 'cat > /tmp/snapshot.yaml'" < "$LOCAL_SCHEMA_PATH"
|
||||
|
||||
echo "🚀 Applying schema to REMOTE $ENV..."
|
||||
ssh "$REMOTE_HOST" "docker exec $REMOTE_CONTAINER npx directus schema apply -y /directus/schema/snapshot.yaml"
|
||||
ssh "$REMOTE_HOST" "docker exec $REMOTE_CONTAINER npx directus schema apply -y /tmp/snapshot.yaml"
|
||||
|
||||
echo "🔄 Restarting remote Directus to clear cache..."
|
||||
ssh "$REMOTE_HOST" "cd $REMOTE_DIR && docker compose -p $PROJECT restart directus"
|
||||
ssh "$REMOTE_HOST" "cd $REMOTE_DIR && docker compose restart directus"
|
||||
|
||||
# Cleanup
|
||||
ssh "$REMOTE_HOST" "docker exec $REMOTE_CONTAINER rm /tmp/snapshot.yaml"
|
||||
;;
|
||||
*)
|
||||
echo "❌ Invalid environment: $ENV. Supported: local, infra."
|
||||
|
||||
Reference in New Issue
Block a user