Schema for a lease platform

database-designschema

I have following tables:

  • A room I want to lease (has user.id as ForeignKey)
  • A users table for users who can rent
    it
  • An availability table for time periods the room is to use with
    prices for that specific period
  • A transaction table with check-in
    and out dates (has member.id and room.id as ForeignKey
  • A billing table

How will I handle the billing?

Schema

Billing so far

Billing so far:

Best Answer

If I were you I would make sure to separate all of the data. Is this going to be completely controlled in the database, or is there going to be an application? If it is an application I would have a users table and permissions tables for the people using the application. I would do a separate a customers table for your customers. I agree with the availability table, but if you are using a price based system I would store that separately. For billing I would set up a few tables. I would have a payment type table and a transaction table with due dates. I like the idea of a check in and out table as well.