-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIRA-CHAL-29 #DONE Create a table in the database for voter registrat…
…ion data (#21) * Deleted a provider * added dataEncryption class and unit tests * added comments to class code * fixed small bugs * fixed PR changes as requested. * more PR changes as requested * deleted unused file * updated comments for decrypt method * created a new entry for the database. Began to add symlink for the database migration and test file * created symlink for 20240711063356_initial_schema.sql * added comments and formated code * Created a script to copy the migration file into the test directory * Made pr changes, fixed symlink script bug * Added the sql file to the test folder * run copy-migration-to-test-folder script before supabase script * changed paths of scripts to get the checks to pass in github * running the copy migration file during the test:ci * changed scripts so that it doesnt just copy the file. It now does the entire directory * added the idNumber field to table * PR review changes * added state field to the database table * changed state_ -> us_state
- Loading branch information
1 parent
3a45eb9
commit 30abec2
Showing
9 changed files
with
98 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
src/__tests__/supabase/migrations/ | ||
|
||
|
||
# testing | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* copies file from @/supabase/migrations/20240711063356_initial_schema.sql --> src/__tests__/supabase/migrations/20240711063356_initial_schema.sql | ||
*/ | ||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
|
||
let sourcePath = path.join(__dirname, '../supabase/migrations'); | ||
let destPath = path.join(__dirname, '../src/__tests__/supabase/migrations'); | ||
|
||
async function copyDirectory() { | ||
try { | ||
await fs.copy(sourcePath, destPath); | ||
console.log('Directory copied successfully!'); | ||
} catch (err) { | ||
console.error('Error copying directory:', err); | ||
} | ||
} | ||
|
||
copyDirectory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
// Define the paths to the directories | ||
const databaseDirPath = path.join(__dirname, '../supabase/migrations'); | ||
const testDirPath = path.join( | ||
__dirname, | ||
'../src/__tests__/supabase/migrations', | ||
); | ||
|
||
// Function to create a symbolic link | ||
function createSymlink(source, destination) { | ||
fs.stat(destination, (err, stats) => { | ||
if (!err) { | ||
console.log(`Existing file or symlink at ${destination}:`); | ||
console.log(`- Is a symlink: ${stats.isSymbolicLink()}`); | ||
console.log(`- Is a file: ${stats.isFile()}`); | ||
console.log(`- Is a directory: ${stats.isDirectory()}`); | ||
console.log(`- Size: ${stats.size} bytes`); | ||
console.log(`- Last modified: ${stats.mtime}\n`); | ||
|
||
if (stats.isSymbolicLink() || stats.isDirectory()) { | ||
console.error( | ||
'Symlink or Directory already exists. Please remove before running this script.', | ||
); | ||
} else { | ||
console.error( | ||
`Error: ${destination} exists but is not a directory or symlink.\n`, | ||
); | ||
} | ||
} else if (err.code === 'ENOENT') { | ||
fs.symlink(source, destination, 'dir', symlinkErr => { | ||
if (symlinkErr) { | ||
console.error(`Error creating symlink: ${symlinkErr.message}\n`); | ||
} else { | ||
console.log(`Symlink created: ${destination} -> ${source}\n`); | ||
} | ||
}); | ||
} else { | ||
console.error(`Error checking destination: ${err.message}\n`); | ||
} | ||
}); | ||
} | ||
|
||
createSymlink(databaseDirPath, testDirPath); |
122 changes: 0 additions & 122 deletions
122
src/__tests__/supabase/migrations/20240711063356_initial_schema.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters