Skip to content

Commit 4a6c399

Browse files
authored
Merge pull request openimis#113 from openimis/develop
Develop
2 parents da8e0e0 + 16dc45a commit 4a6c399

36 files changed

+45271
-40026
lines changed

.github/workflows/file-merge.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Merge SQL files
2+
# This workflow run automatically for every commit on github it checks the syntax and launch the tests.
3+
# | grep . | uniq -c filters out empty lines and then groups consecutive lines together with the number of occurrences
4+
on:
5+
pull_request:
6+
workflow_dispatch:
7+
inputs:
8+
comment:
9+
description: Just a simple comment to know the purpose of the manual build
10+
required: false
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Merge me!
18+
run : bash concatenate_files.sh
19+
- name: Publish artifact
20+
uses: actions/upload-artifact@master
21+
with:
22+
name: sql-files
23+
path: output

.github/workflows/openmis-module-test.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
uses: actions/checkout@v2
3333
with:
3434
path: './new'
35+
- name: generate new files
36+
working-directory: ./new
37+
run: bash concatenate_files.sh
3538
- name: install linux packages
3639
run: |
3740
mkdir ./oldMain
@@ -49,17 +52,16 @@ jobs:
4952
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'DROP DATABASE IF EXISTS imis_1_4_2'
5053
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'CREATE DATABASE imis_1_4_2'
5154
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_1_4_2 -i 1.42/openIMIS_ONLINE.sql | grep . | uniq -c
52-
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_1_4_2 -i "new/Migration script/openIMIS migration latest.sql" | grep . | uniq -c
53-
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_1_4_2 -i "new/Demo database/openIMIS_demo_ONLINE.sql" | grep . | uniq -c
55+
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_1_4_2 -i "new/output/fullMigrationScipt.sql" | grep . | uniq -c
5456
env:
5557
SA_PASSWORD: GitHub999
5658
ACCEPT_EULA: Y
5759
- name: Initialize DB latest
5860
run: |
5961
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'DROP DATABASE IF EXISTS imis'
6062
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'CREATE DATABASE imis'
61-
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis -i "new/Empty databases/openIMIS_ONLINE.sql" | grep . | uniq -c
62-
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis -i "new/Demo database/openIMIS_demo_ONLINE.sql" | grep . | uniq -c
63+
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis -i "new/output/fullDemoDatabase.sql" | grep . | uniq -c
64+
6365
6466
env:
6567
SA_PASSWORD: GitHub999
@@ -70,7 +72,7 @@ jobs:
7072
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'CREATE DATABASE imis_main'
7173
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_main -i oldMain/openIMIS_ONLINE.sql | grep . | uniq -c
7274
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_main -i oldMain/openIMIS_demo_ONLINE.sql | grep . | uniq -c
73-
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_main -i "new/Migration script/openIMIS migration latest.sql" | grep . | uniq -c
75+
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_main -i "new/output/fullMigrationScipt.sql" | grep . | uniq -c
7476
7577
7678
env:
@@ -109,7 +111,6 @@ jobs:
109111
DB_PASSWORD: GitHub999
110112
#DEV_SERVER: true
111113
SITE_ROOT: api
112-
REMOTE_USER_AUTHENTICATION: True
113114
- name: Django tests 1.4.2
114115
working-directory: ./openimis
115116
run: |
@@ -130,7 +131,6 @@ jobs:
130131
DB_PASSWORD: GitHub999
131132
#DEV_SERVER: true
132133
SITE_ROOT: api
133-
REMOTE_USER_AUTHENTICATION: True
134134
- name: Django tests last main
135135
working-directory: ./openimis
136136
run: |
@@ -151,4 +151,3 @@ jobs:
151151
DB_PASSWORD: GitHub999
152152
#DEV_SERVER: true
153153
SITE_ROOT: api
154-
REMOTE_USER_AUTHENTICATION: True
-4.67 MB
Binary file not shown.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[![Automated CI testing](https://github.com/openimis/database_ms_sqlserver/actions/workflows/openmis-module-test.yml/badge.svg?branch=develop)](https://github.com/openimis/database_ms_sqlserver/actions/workflows/openmis-module-test.yml)
12
# openIMIS SQL Server database
23

34
This repository contains the openIMIS database for Microsoft SQL Server.

Tools/Index_rebuild.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ FETCH NEXT FROM TableCursor INTO @TableName
1919
END
2020
CLOSE TableCursor
2121
DEALLOCATE TableCursor
22-
GO
22+
GO

concatenate_files.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
New-Item -ItemType Directory -Force output | Out-Null
2+
Get-Content (Get-ChildItem 'sql\migrations\1_migration_latest.sql','sql\stored_procedures\*.sql' -Recurse -File) > output\fullMigrationScipt.sql
3+
Get-Content (Get-ChildItem 'sql\base\*.sql','sql\stored_procedures\*.sql' -Recurse -File) > output\fullEmptyDatabase.sql
4+
Get-Content (Get-ChildItem 'sql\base\*.sql','sql\stored_procedures\*.sql','sql\demo\*.sql' -Recurse -File) > output\fullDemoDatabase.sql
5+
Get-Content (Get-ChildItem 'sql\base\*.sql','sql\stored_procedures\*.sql','sql\offline\central.sql' -Recurse -File) > output\fullOfflineCentralDatabase.sql
6+
Get-Content (Get-ChildItem 'sql\base\*.sql','sql\stored_procedures\*.sql','sql\offline\hf.sql' -Recurse -File) > output\fullOfflineHFDatabase.sql

concatenate_files.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
mkdir output
4+
cat sql/migrations/1_migration_latest.sql sql/stored_procedures/*.sql > output/fullMigrationScipt.sql
5+
cat sql/base/*.sql sql/stored_procedures/*.sql > output/fullEmptyDatabase.sql
6+
cat sql/base/*.sql sql/stored_procedures/*.sql sql/demo/*.sql> output/fullDemoDatabase.sql
7+
cat sql/base/*.sql sql/stored_procedures/*.sql sql/offline/central.sql > output/fullOfflineCentralDatabase.sql
8+
cat sql/base/*.sql sql/stored_procedures/*.sql sql/offline/hf.sql > output/fullOfflineHFDatabase.sql

0 commit comments

Comments
 (0)