Skip to content

Commit 764f424

Browse files
committed
docs: add details about uploads import/export/backup scripts
1 parent b657241 commit 764f424

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

README.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,58 @@ This theme uses the following files for linting:
105105

106106
### Syncing Environments
107107

108-
The preferred mechanism for syncing your environment with others is to use database imports and exports. This repo has a few scripts to make this process as easy as possible. While your containers are running, you can run any of these commands to import, export, or backup a database. Here are the quick commands, with more instructions below.
108+
The preferred mechanism for syncing your environment with others is to use database/uploads imports and exports. This repo has a few scripts to make this process as easy as possible. While your containers are running, you can run any of these commands to import, export, or backup a database or your `uploads` folder. Here are the quick commands, with more instructions below.
109109

110110
```sh
111111
# import a DB from the `sync/sql` folder
112112
npm run import:db
113113

114+
# import images/files into your uploads folder from a zip file in `sync/uploads`
115+
npm run import:uploads
116+
117+
# run both a DB import and an uploads import at once
118+
npm run import
119+
114120
# export your DB
115121
npm run export:db
116122

117123
# export your DB with a custom name
118124
npm run export:db validation-data
119125

126+
# export your uploads folder as a zip file
127+
npm run export:uploads
128+
129+
# export your uploads with a custom name
130+
npm run export:uploads validation-uploads
131+
132+
# run both a DB export and an uploads export at once
133+
npm run export
134+
135+
# run DB/uploads exports with a custom name
136+
npm run export validation
137+
120138
# backup your DB in case you need to restore it later
121139
npm run backup:db
122140

123141
# backup your DB with a custom name
124-
npm run backup:db work-in-progress
142+
npm run backup:db work-in-progress-data
143+
144+
# backup your uploads folder in case you need to restore it later
145+
npm run backup:uploads
146+
147+
# backup your uploads folder with a custom name
148+
npm run backup:uploads work-in-progress-uploads
149+
150+
# run both a DB backup and an uploads backup at once
151+
npm run backup
152+
153+
# run DB/uploads backups with a custom name
154+
npm run export work-in-progress
125155
```
126156

127157
#### Importing Databases
128158

129-
You can import databases from production, a saved backup, or another developer's DB export with the `import:db` script. To use it, put a `*.sql.gz` file in a top-level `sync/sql` folder in the repo and run `npm run import:db`. This will first back up your existing database in case you need to revert back to it, and then it will import the database from the given file, effectively replacing your database with a new one.
159+
You can import databases from production, a saved backup, or another developer's DB export with the `import:db` script. To use it, put a `*.sql.gz` file directly inside of a `sync/sql` folder in the repo and run `npm run import:db`. This will first back up your existing database to `sync/sql/backups` in case you need to revert back to it, and then it will import the database from the given file, effectively replacing your database with a new one. The imported SQL script will then be moved to `sync/sql/previous-imports`.
130160

131161
#### Exporting Databases
132162

@@ -136,6 +166,18 @@ You can export your database for another developer to import or to import to a s
136166

137167
This will happen automatically when you import a database, but if you want to manually backup your database, you can run `npm run backup:db`. This functions nearly identically to the `export:db` script, except for using a different prefix and putting the file in `sync/sql/backups`. As with `export:db`, you can specify a name for your DB backup if you want.
138168

169+
#### Importing Uploads
170+
171+
You can import a zipped copy of the `uploads` folder from another environment, saved backup, or another developer's export with the `import:uploads` script. To use it, put a `*.tar.gz` file directly inside of a `sync/uploads` folder in the repo and run `npm run import:uploads`. This will first back up your current `uploads` folder to `sync/uploads/backups`, and then it will replace your `uploads` folder with the contents of the zip file. The imported `.tar.gz` file will then be moved to `sync/uploads/previous-imports`.
172+
173+
#### Exporting Uploads
174+
175+
You can export your `uploads` folder for another developer to import or to import to another environment by running `npm run export:uploads`. By default, this will create a timestamped zip file in `sync/uploads/exports`, but you can specify a name by running `npm run export:uploads <your-descriptive-name-here>`. The exported file will still be timestamped, but it will use the name you give it instead of the default prefix.
176+
177+
#### Backing Up Uploads
178+
179+
This will happen automatically on import, but if you want to manually backup your `uploads` folder, you can run `npm run backup:uploads`. This functions nearly identically to the `export:uploads` script, except for using a different prefix and putting the zip file in `sync/uploads/backups`. As with `export:uploads`, you can specify a name for your backup if you want.
180+
139181
### Atom
140182

141183
If you use Atom, go to Preferences > Packages. Open the `language-php` Core Package settings. Go to the Tab Type setting and set the drop down option to `hard`.

0 commit comments

Comments
 (0)