@tricoteuses/senat 2.9.10 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,6 +79,8 @@ async function copyToSenat(dataset, dataDir, options) {
79
79
  const schemaDumpFile = path.join(dataDir, `${dataset.database}_schema_dump.sql`);
80
80
  // Write the header and then stream the rest of the SQL file
81
81
  const schemaSqlWriter = fs.createWriteStream(schemaDumpFile, { encoding: "utf8" });
82
+ // Add CREATE SCHEMA statement at the top
83
+ schemaSqlWriter.write(`CREATE SCHEMA IF NOT EXISTS ${dataset.database};\n`);
82
84
  const lineReader = readline.createInterface({
83
85
  input: fs.createReadStream(sqlFilePath, { encoding: "utf8" }),
84
86
  crlfDelay: Infinity,
@@ -110,9 +112,9 @@ async function copyToSenat(dataset, dataDir, options) {
110
112
  schemaSqlWriter.on("finish", () => {
111
113
  try {
112
114
  execSync(`${options["sudo"] ? `sudo -u ${options["sudo"]} ` : ""}psql --quiet -d senat -f ${schemaDumpFile}`, {
113
- cwd: dataDir,
114
115
  env: process.env,
115
116
  encoding: "utf-8",
117
+ stdio: ["ignore", "ignore", "pipe"],
116
118
  });
117
119
  }
118
120
  finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tricoteuses/senat",
3
- "version": "2.9.10",
3
+ "version": "2.10.0",
4
4
  "description": "Handle French Sénat's open data",
5
5
  "keywords": [
6
6
  "France",