Skip to content

Commit

Permalink
Alphanumeric IDs, image sizes, image deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbotailz committed Oct 10, 2021
1 parent 58c2139 commit 3b8ea24
Show file tree
Hide file tree
Showing 147 changed files with 2,223 additions and 4,823 deletions.
7 changes: 4 additions & 3 deletions database/migrations/20210124214536_create_images_table.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

exports.up = function(knex) {
return knex.schema.createTable('images', table => {
table.increments();
table.string('caption');
table.string('source').notNullable();
table.string('id').primary().notNullable();
table.string('source_small').notNullable();
table.string('source_medium').notNullable();
table.string('source_large').notNullable();
table.timestamp('taken_at');
table.timestamp('created_at').defaultTo(knex.fn.now());
table.timestamp('updated_at').defaultTo(knex.fn.now());
Expand Down
38 changes: 19 additions & 19 deletions database/seeds/01_images.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ const filePath = __dirname + '/images/';
const images = fs.readdirSync(filePath);

exports.seed = async knex => {
// // Deletes ALL existing entries
// console.log('Deleting all image records...');
// await knex('images').del();
// console.log('Done');
//
// // Inserts images into the database
// console.log('Inserting images to database...');
// const promises = [];
//
// for (const image of images) {
// const buffer = fs.readFileSync(filePath + image);
// promises.push(putImage(buffer, null, knex));
// }
//
// console.log('Done');
//
// return Promise.all(promises).then(() => {
// console.log('Done');
// });
// Deletes ALL existing entries
console.log('Deleting all image records...');
await knex('images').del();
console.log('Done');

// Inserts images into the database
console.log('Inserting images to database...');
const promises = [];

for (const image of images) {
const buffer = fs.readFileSync(filePath + image);
promises.push(putImage(buffer, null, knex));
}

console.log('Done');

return Promise.all(promises).then(() => {
console.log('Done');
});
};
Binary file removed database/seeds/images/M100.jpg
Binary file not shown.
Binary file removed database/seeds/images/M101.jpg
Binary file not shown.
Binary file removed database/seeds/images/M102.jpg
Binary file not shown.
Binary file removed database/seeds/images/M103.jpg
Binary file not shown.
Binary file removed database/seeds/images/M104.jpg
Binary file not shown.
Binary file removed database/seeds/images/M105.jpg
Binary file not shown.
Binary file removed database/seeds/images/M106.jpg
Binary file not shown.
Binary file removed database/seeds/images/M107.jpg
Binary file not shown.
Binary file removed database/seeds/images/M108.jpg
Binary file not shown.
Binary file removed database/seeds/images/M109.jpg
Binary file not shown.
Binary file removed database/seeds/images/M11.jpg
Binary file not shown.
Binary file removed database/seeds/images/M110.jpg
Binary file not shown.
Binary file removed database/seeds/images/M111.jpg
Binary file not shown.
Binary file removed database/seeds/images/M112.jpg
Binary file not shown.
Binary file removed database/seeds/images/M113.jpg
Binary file not shown.
Binary file removed database/seeds/images/M114.jpg
Binary file not shown.
Binary file removed database/seeds/images/M115.jpg
Binary file not shown.
Binary file removed database/seeds/images/M116.jpg
Binary file not shown.
Binary file removed database/seeds/images/M117.jpg
Binary file not shown.
Binary file removed database/seeds/images/M118.jpg
Binary file not shown.
Binary file removed database/seeds/images/M119.jpg
Binary file not shown.
Binary file removed database/seeds/images/M12.jpg
Binary file not shown.
Binary file removed database/seeds/images/M120.jpg
Binary file not shown.
Binary file removed database/seeds/images/M121.jpg
Binary file not shown.
Binary file removed database/seeds/images/M122.jpg
Binary file not shown.
Binary file removed database/seeds/images/M123.jpg
Diff not rendered.
Binary file removed database/seeds/images/M124.jpg
Diff not rendered.
Binary file removed database/seeds/images/M125.jpg
Diff not rendered.
Binary file removed database/seeds/images/M126.jpg
Diff not rendered.
Binary file removed database/seeds/images/M127.jpg
Diff not rendered.
Binary file removed database/seeds/images/M128.jpg
Diff not rendered.
Binary file removed database/seeds/images/M129.jpg
Diff not rendered.
Binary file removed database/seeds/images/M13.jpg
Diff not rendered.
Binary file removed database/seeds/images/M130.jpg
Diff not rendered.
Binary file removed database/seeds/images/M131.jpg
Diff not rendered.
Binary file removed database/seeds/images/M132.jpg
Diff not rendered.
Binary file removed database/seeds/images/M133.jpg
Diff not rendered.
Binary file removed database/seeds/images/M134.jpg
Diff not rendered.
Binary file removed database/seeds/images/M135.jpg
Diff not rendered.
Binary file removed database/seeds/images/M136.jpg
Diff not rendered.
Binary file removed database/seeds/images/M137.jpg
Diff not rendered.
Binary file removed database/seeds/images/M138.jpg
Diff not rendered.
Binary file removed database/seeds/images/M139.jpg
Diff not rendered.
Binary file removed database/seeds/images/M14.jpg
Diff not rendered.
Binary file removed database/seeds/images/M140.jpg
Diff not rendered.
Binary file removed database/seeds/images/M141.jpg
Diff not rendered.
Binary file removed database/seeds/images/M142.jpg
Diff not rendered.
Binary file removed database/seeds/images/M143.jpg
Diff not rendered.
Binary file removed database/seeds/images/M144.jpg
Diff not rendered.
Binary file removed database/seeds/images/M145.jpg
Diff not rendered.
Binary file removed database/seeds/images/M146.jpg
Diff not rendered.
Binary file removed database/seeds/images/M147.jpg
Diff not rendered.
Binary file removed database/seeds/images/M15.jpg
Diff not rendered.
Binary file removed database/seeds/images/M16.jpg
Diff not rendered.
Binary file removed database/seeds/images/M17.jpg
Diff not rendered.
Binary file removed database/seeds/images/M18.jpg
Diff not rendered.
Binary file removed database/seeds/images/M19.jpg
Diff not rendered.
Binary file removed database/seeds/images/M20.jpg
Diff not rendered.
Binary file removed database/seeds/images/M21.jpg
Diff not rendered.
Binary file removed database/seeds/images/M22.jpg
Diff not rendered.
Binary file removed database/seeds/images/M23.jpg
Diff not rendered.
Binary file removed database/seeds/images/M24.jpg
Diff not rendered.
Binary file removed database/seeds/images/M25.jpg
Diff not rendered.
Binary file removed database/seeds/images/M26.jpg
Diff not rendered.
Binary file removed database/seeds/images/M27.jpg
Diff not rendered.
Binary file removed database/seeds/images/M28.jpg
Diff not rendered.
Binary file removed database/seeds/images/M29.jpg
Diff not rendered.
Binary file removed database/seeds/images/M30.jpg
Diff not rendered.
Binary file removed database/seeds/images/M31.jpg
Diff not rendered.
Binary file removed database/seeds/images/M32.jpg
Diff not rendered.
Binary file removed database/seeds/images/M33.jpg
Diff not rendered.
Binary file removed database/seeds/images/M34.jpg
Diff not rendered.
Binary file removed database/seeds/images/M35.jpg
Diff not rendered.
Binary file removed database/seeds/images/M36.jpg
Diff not rendered.
Binary file removed database/seeds/images/M37.jpg
Diff not rendered.
Binary file removed database/seeds/images/M38.jpg
Diff not rendered.
Binary file removed database/seeds/images/M39.jpg
Diff not rendered.
Binary file removed database/seeds/images/M40.jpg
Diff not rendered.
Binary file removed database/seeds/images/M41.jpg
Diff not rendered.
Binary file removed database/seeds/images/M42.jpg
Diff not rendered.
Binary file removed database/seeds/images/M43.jpg
Diff not rendered.
Binary file removed database/seeds/images/M44.jpg
Diff not rendered.
Binary file removed database/seeds/images/M45.jpg
Diff not rendered.
Binary file removed database/seeds/images/M46.jpg
Diff not rendered.
Binary file removed database/seeds/images/M47.jpg
Diff not rendered.
Binary file removed database/seeds/images/M48.jpg
Diff not rendered.
Binary file removed database/seeds/images/M49.jpg
Diff not rendered.
Binary file removed database/seeds/images/M50.jpg
Diff not rendered.
Binary file removed database/seeds/images/M51.jpg
Diff not rendered.
Binary file removed database/seeds/images/M52.jpg
Diff not rendered.
Binary file removed database/seeds/images/M53.jpg
Diff not rendered.
Binary file removed database/seeds/images/M54.jpg
Diff not rendered.
Binary file removed database/seeds/images/M55.jpg
Diff not rendered.
Binary file removed database/seeds/images/M56.jpg
Diff not rendered.
Binary file removed database/seeds/images/M57.jpg
Diff not rendered.
Binary file removed database/seeds/images/M58.jpg
Diff not rendered.
Binary file removed database/seeds/images/M59.jpg
Diff not rendered.
Binary file removed database/seeds/images/M60.jpg
Diff not rendered.
Binary file removed database/seeds/images/M61.jpg
Diff not rendered.
Binary file removed database/seeds/images/M62.jpg
Diff not rendered.
Binary file removed database/seeds/images/M63.jpg
Diff not rendered.
Binary file removed database/seeds/images/M64.jpg
Diff not rendered.
Binary file removed database/seeds/images/M65.jpg
Diff not rendered.
Binary file removed database/seeds/images/M66.jpg
Diff not rendered.
Binary file removed database/seeds/images/M67.jpg
Diff not rendered.
Binary file removed database/seeds/images/M68.jpg
Diff not rendered.
Binary file removed database/seeds/images/M69.jpg
Diff not rendered.
Binary file removed database/seeds/images/M70.jpg
Diff not rendered.
Binary file removed database/seeds/images/M71.jpg
Diff not rendered.
Binary file removed database/seeds/images/M72.jpg
Diff not rendered.
Binary file removed database/seeds/images/M73.jpg
Diff not rendered.
Binary file removed database/seeds/images/M74.jpg
Diff not rendered.
Binary file removed database/seeds/images/M75.jpg
Diff not rendered.
Binary file removed database/seeds/images/M76.jpg
Diff not rendered.
Binary file removed database/seeds/images/M77.jpg
Diff not rendered.
Binary file removed database/seeds/images/M78.jpg
Diff not rendered.
Binary file removed database/seeds/images/M79.jpg
Diff not rendered.
Binary file removed database/seeds/images/M80.jpg
Diff not rendered.
Binary file removed database/seeds/images/M81.jpg
Diff not rendered.
Binary file removed database/seeds/images/M82.jpg
Diff not rendered.
Binary file removed database/seeds/images/M83.jpg
Diff not rendered.
Binary file removed database/seeds/images/M84.jpg
Diff not rendered.
Binary file removed database/seeds/images/M85.jpg
Diff not rendered.
Binary file removed database/seeds/images/M86.jpg
Diff not rendered.
Binary file removed database/seeds/images/M87.jpg
Diff not rendered.
Binary file removed database/seeds/images/M88.jpg
Diff not rendered.
Binary file removed database/seeds/images/M89.jpg
Diff not rendered.
Binary file removed database/seeds/images/M90.jpg
Diff not rendered.
Binary file removed database/seeds/images/M91.jpg
Diff not rendered.
Binary file removed database/seeds/images/M92.jpg
Diff not rendered.
Binary file removed database/seeds/images/M93.jpg
Diff not rendered.
Binary file removed database/seeds/images/M94.jpg
Diff not rendered.
Binary file removed database/seeds/images/M95.jpg
Diff not rendered.
Binary file removed database/seeds/images/M96.jpg
Diff not rendered.
Binary file removed database/seeds/images/M97.jpg
Diff not rendered.
Binary file removed database/seeds/images/M98.jpg
Diff not rendered.
Binary file removed database/seeds/images/M99.jpg
Diff not rendered.
Loading

0 comments on commit 3b8ea24

Please sign in to comment.